refactor(repo): refresh extras release_attachment handler
zhenyi committed
Modified lib/repo/handler/extras/release_attachment.rs lib/repo/handler/extras/release_attachment.rs +8 −7 View lib/repo/handler/extras/release_attachment.rs
@@ -1,5 +1,6 @@
1use axum::Json;
21use axum::extract::{Path, State};
2use export::data::AppResponseData;
3
34use jwt::extractor::AuthUser;
45use uuid::Uuid;
56
@@ -11,34 +12,34 @@
1112 get,
1213 path = "/repo/{channel_id}/{repo_id}/releases/{release_id}/assets",
1314 tag = "repo",
14 responses((status = 200, description = "List release attachments", body = ReleaseAttachmentListResponse)),
15 responses((status = 200, description = "List release attachments", body = AppResponseData<ReleaseAttachmentListResponse>)),
1516 security(("bearer_auth" = []))
1617)]
1718pub(crate) async fn list_handler(
1819 State(svc): State<RepoService>,
1920 AuthUser { claims }: AuthUser,
2021 Path((_, repo_id, release_id)): Path<(Uuid, Uuid, Uuid)>,
21) -> RepoResult<Json<ReleaseAttachmentListResponse>> {
22) -> RepoResult<AppResponseData<ReleaseAttachmentListResponse>> {
2223 let out = svc
2324 .list_release_attachments(claims.sub, repo_id, release_id)
2425 .await?;
25 Ok(Json(out))
26 Ok(AppResponseData::ok(out))
2627}
2728
2829#[utoipa::path(
2930 get,
3031 path = "/repo/{channel_id}/{repo_id}/releases/{release_id}/assets/{attachment_id}",
3132 tag = "repo",
32 responses((status = 200, description = "Get a release attachment", body = ReleaseAttachmentView)),
33 responses((status = 200, description = "Get a release attachment", body = AppResponseData<ReleaseAttachmentView>)),
3334 security(("bearer_auth" = []))
3435)]
3536pub(crate) async fn get_handler(
3637 State(svc): State<RepoService>,
3738 AuthUser { claims }: AuthUser,
3839 Path((_, repo_id, release_id, attachment_id)): Path<(Uuid, Uuid, Uuid, Uuid)>,
39) -> RepoResult<Json<ReleaseAttachmentView>> {
40) -> RepoResult<AppResponseData<ReleaseAttachmentView>> {
4041 let out = svc
4142 .get_release_attachment(claims.sub, repo_id, release_id, attachment_id)
4243 .await?;
43 Ok(Json(out))
44 Ok(AppResponseData::ok(out))
4445}