Could use more partials to reduce some of the current repetition (especially forms), but this is a start with everything converted.
16 lines
421 B
Rust
16 lines
421 B
Rust
use axum::extract::{Query, State};
|
|
use maud::Markup;
|
|
use sqlx::PgPool;
|
|
|
|
use crate::error::Result;
|
|
use crate::models::entry::{Entry, GetEntriesOptions};
|
|
use crate::partials::entry_list::entry_list;
|
|
|
|
pub async fn get(
|
|
Query(options): Query<GetEntriesOptions>,
|
|
State(pool): State<PgPool>,
|
|
) -> Result<Markup> {
|
|
let entries = Entry::get_all(&pool, &options).await?;
|
|
Ok(entry_list(entries, &options, false))
|
|
}
|