Skip to content
Clone

refactor(repo): refresh contents diff_patch handler

zhenyi committed
parent 9ce250b commit 6a40469 Browse files

1 file changed

+8 −7

Modified lib/repo/handler/contents/diff_patch.rs View lib/repo/handler/contents/diff_patch.rs
@@ -1,5 +1,6 @@
1use axum::Json;
21use axum::extract::{Path, State};
2use export::data::{AppRequest, AppRequestData, AppResponseData};
3
34use jwt::extractor::AuthUser;
45use uuid::Uuid;
56
@@ -11,16 +12,16 @@
1112 post,
1213 path = "/repo/{channel_id}/{repo_id}/diffpatch",
1314 tag = "repo",
14 request_body = ApplyDiffPatchFileOptions,
15 responses((status = 200, description = "Apply a diff patch", body = ContentsResponse)),
15 request_body = AppRequestData<ApplyDiffPatchFileOptions>,
16 responses((status = 200, description = "Apply a diff patch", body = AppResponseData<ContentsResponse>)),
1617 security(("bearer_auth" = []))
1718)]
1819pub(crate) async fn handler(
1920 State(svc): State<RepoService>,
2021 AuthUser { claims }: AuthUser,
2122 Path((_, repo_id)): Path<(Uuid, Uuid)>,
22 Json(input): Json<ApplyDiffPatchFileOptions>,
23) -> RepoResult<Json<ContentsResponse>> {
24 let resp = svc.apply_diff_patch(claims.sub, repo_id, input).await?;
25 Ok(Json(resp))
23 input: AppRequest<ApplyDiffPatchFileOptions>,
24) -> RepoResult<AppResponseData<ContentsResponse>> {
25 let resp = svc.apply_diff_patch(claims.sub, repo_id, input.into_inner()).await?;
26 Ok(AppResponseData::ok(resp))
2627}