a06673b
use axum::Json;
use axum::extract::{Path, State};
use axum::http::StatusCode;
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::RepoResult;
use crate::features::RepoService;
use crate::features::contents::DeleteFileOption;
#[utoipa::path(
delete,
path = "/repo/{channel_id}/{repo_id}/contents/{path}",
tag = "repo",
request_body = DeleteFileOption,
responses((status = 204, description = "Delete a file")),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id, path)): Path<(Uuid, Uuid, String)>,
Json(input): Json<DeleteFileOption>,
) -> RepoResult<StatusCode> {
svc.delete_file(claims.sub, repo_id, &path, input).await?;
Ok(StatusCode::NO_CONTENT)
}