Skip to content
Clone

refactor(repo): refresh tag create handler

zhenyi committed
parent 4072540 commit 04a170d Browse files

1 file changed

+8 −8

Modified lib/repo/handler/tag/create.rs View lib/repo/handler/tag/create.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,16 +12,16 @@
1212 post,
1313 path = "/repo/{channel_id}/{repo_id}/tags",
1414 tag = "repo",
15 request_body = CreateTagOption,
16 responses((status = 201, description = "Create a tag", body = TagView)),
15 request_body = AppRequestData<CreateTagOption>,
16 responses((status = 201, description = "Create a tag", body = AppResponseData<TagView>)),
1717 security(("bearer_auth" = []))
1818)]
1919pub(crate) async fn handler(
2020 State(svc): State<RepoService>,
2121 AuthUser { claims }: AuthUser,
2222 Path((_, repo_id)): Path<(Uuid, Uuid)>,
23 Json(input): Json<CreateTagOption>,
24) -> RepoResult<(StatusCode, Json<TagView>)> {
25 let view = svc.create_tag(claims.sub, repo_id, input).await?;
26 Ok((StatusCode::CREATED, Json(view)))
23 input: AppRequest<CreateTagOption>,
24) -> RepoResult<AppResponseData<TagView>> {
25 let view = svc.create_tag(claims.sub, repo_id, input.into_inner()).await?;
26 Ok(AppResponseData::ok(view).with_code(201))
2727}