refactor(repo): refresh branch_protection get handler
zhenyi committed
Modified lib/repo/handler/branch_protection/get.rs lib/repo/handler/branch_protection/get.rs +5 −4 View lib/repo/handler/branch_protection/get.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,16 +12,16 @@
1112 get,
1213 path = "/repo/{channel_id}/{repo_id}/branch_protections/{policy_id}",
1314 tag = "repo",
14 responses((status = 200, description = "Get a branch protection", body = BranchProtectionView)),
15 responses((status = 200, description = "Get a branch protection", body = AppResponseData<BranchProtectionView>)),
1516 security(("bearer_auth" = []))
1617)]
1718pub(crate) async fn handler(
1819 State(svc): State<RepoService>,
1920 AuthUser { claims }: AuthUser,
2021 Path((_, repo_id, policy_id)): Path<(Uuid, Uuid, Uuid)>,
21) -> RepoResult<Json<BranchProtectionView>> {
22) -> RepoResult<AppResponseData<BranchProtectionView>> {
2223 let view = svc
2324 .get_branch_protection(claims.sub, repo_id, policy_id)
2425 .await?;
25 Ok(Json(view))
26 Ok(AppResponseData::ok(view))
2627}