Skip to content
Clone
b7cd2b1
31 lines 999 B Rust
use export::http::{Path, State};
use export::rest::{AppResponseData, NoData};
use jwt::Session;
use uuid::Uuid;
use crate::errors::ApiError;
use crate::services::service::UserService;
use jwt::share::session;
#[utoipa::path(
delete,
path = "/me/push-subscriptions/{push_id}",
tag = "user",
description = "删除当前用户的指定推送订阅。",
params(
("push_id" = Uuid, Path, description = "push subscription id")
),
responses(
(status = 200, description = "push subscription deleted", body = AppResponseData<NoData>),
(status = 401, description = "authentication required", body = AppResponseData<NoData>)
)
)]
pub async fn delete_push_subscription(
State(service): State<UserService>,
session: Session,
Path(push_id): Path<Uuid>,
) -> Result<AppResponseData<NoData>, ApiError> {
let uid = session::require_uid(&session)?;
service.delete_push_subscription(uid, push_id).await?;
Ok(AppResponseData::empty())
}