Can update inbox entry information

This commit is contained in:
2025-05-08 16:54:21 +02:00
parent b6af889dc5
commit 6c41b66d1c
4 changed files with 21 additions and 2 deletions

View File

@@ -41,3 +41,18 @@ pub async fn get_list(auth: AuthExtractor, query: web::Query<GetInboxQuery>) ->
pub async fn get_single(entry: InboxEntryInPath) -> HttpResult {
Ok(HttpResponse::Ok().json(entry.as_ref()))
}
/// Update a single inbox entry information
pub async fn update(
auth: AuthExtractor,
inbox_entry: InboxEntryInPath,
req: web::Json<UpdateInboxEntryQuery>,
) -> HttpResult {
if let Some(err) = req.check_error(auth.user_id()).await? {
return Ok(HttpResponse::BadRequest().json(err));
}
inbox_service::update(inbox_entry.as_ref().id(), &req).await?;
Ok(HttpResponse::Ok().json(inbox_service::get_by_id(inbox_entry.as_ref().id()).await?))
}