Add a route to get the list of inbox entries

This commit is contained in:
2025-05-08 16:34:00 +02:00
parent b6281be349
commit df7f395e8b
4 changed files with 34 additions and 5 deletions

View File

@ -14,3 +14,24 @@ pub async fn create(auth: AuthExtractor, req: web::Json<UpdateInboxEntryQuery>)
Ok(HttpResponse::Created().finish())
}
#[derive(serde::Deserialize)]
pub struct GetInboxQuery {
#[serde(default)]
include_attached: bool,
}
/// Get inbox content
pub async fn get_list(auth: AuthExtractor, query: web::Query<GetInboxQuery>) -> HttpResult {
let mut list = inbox_service::get_list_user(auth.user_id()).await?;
list.retain(|entry| {
if !query.include_attached && entry.movement_id().is_some() {
return false;
}
true
});
Ok(HttpResponse::Ok().json(list))
}