refactor(repo): refresh lifecycle fork handler
zhenyi committed
Modified lib/repo/handler/lifecycle/fork.rs lib/repo/handler/lifecycle/fork.rs +8 −8 View lib/repo/handler/lifecycle/fork.rs
@@ -1,6 +1,6 @@
1use axum::Json;
21use axum::extract::{Path, State};
3use axum::http::StatusCode;
2use export::data::{AppRequest, AppRequestData, AppResponseData};
3
44use jwt::extractor::AuthUser;
55use uuid::Uuid;
66
@@ -12,18 +12,18 @@
1212 post,
1313 path = "/repo/{channel_id}/{repo_id}/forks",
1414 tag = "repo",
15 request_body = ForkRepoOption,
16 responses((status = 201, description = "Fork a repository", body = RepoView)),
15 request_body = AppRequestData<ForkRepoOption>,
16 responses((status = 201, description = "Fork a repository", body = AppResponseData<RepoView>)),
1717 security(("bearer_auth" = []))
1818)]
1919pub(crate) async fn handler(
2020 State(svc): State<RepoService>,
2121 AuthUser { claims }: AuthUser,
2222 Path((channel_id, repo_id)): Path<(Uuid, Uuid)>,
23 Json(input): Json<ForkRepoOption>,
24) -> RepoResult<(StatusCode, Json<RepoView>)> {
23 input: AppRequest<ForkRepoOption>,
24) -> RepoResult<AppResponseData<RepoView>> {
2525 let view = svc
26 .fork_repo(claims.sub, channel_id, repo_id, input)
26 .fork_repo(claims.sub, channel_id, repo_id, input.into_inner())
2727 .await?;
28 Ok((StatusCode::CREATED, Json(view)))
28 Ok(AppResponseData::ok(view).with_code(201))
2929}