Skip to content
Clone

refactor(repo): refresh contents delete handler

zhenyi committed
parent 7621048 commit 9ce250b Browse files

1 file changed

+7 −7

Modified lib/repo/handler/contents/delete.rs View lib/repo/handler/contents/delete.rs
@@ -1,6 +1,6 @@
1use axum::Json;
21use axum::extract::{Path, State};
3use axum::http::StatusCode;
2use export::data::{AppRequest, AppRequestData, AppResponseData, NoData};
3
44use jwt::extractor::AuthUser;
55use uuid::Uuid;
66
@@ -12,7 +12,7 @@
1212 delete,
1313 path = "/repo/{channel_id}/{repo_id}/contents/{path}",
1414 tag = "repo",
15 request_body = DeleteFileOption,
15 request_body = AppRequestData<DeleteFileOption>,
1616 responses((status = 204, description = "Delete a file")),
1717 security(("bearer_auth" = []))
1818)]
@@ -20,8 +20,8 @@
2020 State(svc): State<RepoService>,
2121 AuthUser { claims }: AuthUser,
2222 Path((_, repo_id, path)): Path<(Uuid, Uuid, String)>,
23 Json(input): Json<DeleteFileOption>,
24) -> RepoResult<StatusCode> {
25 svc.delete_file(claims.sub, repo_id, &path, input).await?;
26 Ok(StatusCode::NO_CONTENT)
23 input: AppRequest<DeleteFileOption>,
24) -> RepoResult<AppResponseData<NoData>> {
25 svc.delete_file(claims.sub, repo_id, &path, input.into_inner()).await?;
26 Ok(AppResponseData::<NoData>::empty())
2727}