Add published_at to entries, begin to support pagination

Articles will be sorted by their published_at dates for now.
This commit is contained in:
2023-06-08 01:20:21 -04:00
parent 3f29138bd1
commit 758e644173
6 changed files with 106 additions and 36 deletions

View File

@@ -2,8 +2,8 @@ use axum::{extract::State, Json};
use sqlx::PgPool;
use crate::error::Error;
use crate::models::entry::{get_entries, Entry};
use crate::models::entry::{get_entries, Entry, GetEntriesOptions};
pub async fn get(State(pool): State<PgPool>) -> Result<Json<Vec<Entry>>, Error> {
Ok(Json(get_entries(&pool).await?))
Ok(Json(get_entries(&pool, GetEntriesOptions::default()).await?))
}