include meta in info endpoint

This commit is contained in:
Niccolo Borgioli 2023-05-23 09:38:23 +02:00
parent 85204776d7
commit 6000553b95
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,9 @@ pub struct Note {
}
#[derive(Serialize, Deserialize, Clone)]
pub struct NoteInfo {}
pub struct NoteInfo {
pub meta: String,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct NotePublic {

View File

@ -24,7 +24,7 @@ async fn one(path: web::Path<NotePath>) -> impl Responder {
let note = store::get(&p.id);
match note {
Ok(Some(_)) => HttpResponse::Ok().json(NoteInfo {}),
Ok(Some(n)) => HttpResponse::Ok().json(NoteInfo { meta: n.meta }),
Ok(None) => HttpResponse::NotFound().finish(),
Err(e) => HttpResponse::InternalServerError().body(e.to_string()),
}