Add crawl metadata to feed & improve model interface
This commit is contained in:
@@ -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?))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user