main
use ::session::AuthedUser;
use api::http::{Path, State};
use api::rest::{AppResponseData, NoData};
use uuid::Uuid;
use crate::AuthService;
use crate::errors::ApiError;
#[utoipa::path(
delete,
path = "/me/notifications/{notification_id}",
tag = "notifications",
description = "删除当前用户名下的指定通知记录。",
params(
("notification_id" = Uuid, Path, description = "notification id")
),
responses(
(status = 200, description = "notification deleted", body = AppResponseData<NoData>),
(status = 401, description = "authentication required", body = AppResponseData<NoData>)
)
)]
pub async fn delete_notification(
State(service): State<AuthService>,
AuthedUser(uid): AuthedUser,
Path(notification_id): Path<Uuid>,
) -> Result<AppResponseData<NoData>, ApiError> {
service
.delete_notification(uid, notification_id)
.await
.map_err(ApiError::from)?;
Ok(AppResponseData::empty())
}