Add crawl metadata to feed & improve model interface

This commit is contained in:
2023-07-15 00:36:44 -04:00
parent 0fa0cfc508
commit 4837cbb903
18 changed files with 621 additions and 522 deletions

View File

@@ -5,19 +5,19 @@ use axum::{
use sqlx::PgPool;
use crate::error::Error;
use crate::models::entry::{create_entry, get_entry, CreateEntry, Entry};
use crate::models::entry::{CreateEntry, Entry};
use crate::uuid::Base62Uuid;
pub async fn get(
State(pool): State<PgPool>,
Path(id): Path<Base62Uuid>,
) -> Result<Json<Entry>, Error> {
Ok(Json(get_entry(&pool, id.as_uuid()).await?))
Ok(Json(Entry::get(&pool, id.as_uuid()).await?))
}
pub async fn post(
State(pool): State<PgPool>,
Json(payload): Json<CreateEntry>,
) -> Result<Json<Entry>, Error> {
Ok(Json(create_entry(&pool, payload).await?))
Ok(Json(Entry::create(&pool, payload).await?))
}