use axum::extract::{Path, State}; use export::data::{AppResponseData, NoData}; use jwt::extractor::AuthUser; use uuid::Uuid; use crate::error::{IssueError, IssueResult}; use crate::features::IssueService; use crate::features::issue_attachment::owner_type_from_str; #[utoipa::path( delete, path = "/issues/{channel_id}/attachments/{owner_type}/{owner_id}/{att_id}", tag = "issues", responses((status = 204, description = "Delete attachment")), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path((channel_id, owner_type, owner_id, att_id)): Path<(Uuid, String, Uuid, Uuid)>, ) -> IssueResult> { let owner_type = owner_type_from_str(&owner_type) .ok_or_else(|| IssueError::BadRequest(format!("invalid owner_type {owner_type}")))?; svc.delete_attachment(claims.sub, channel_id, owner_type, owner_id, att_id) .await?; Ok(AppResponseData::::empty()) }