refactor(repo): refresh extras repo_extra handler
zhenyi committed
Modified lib/repo/handler/extras/repo_extra.rs lib/repo/handler/extras/repo_extra.rs +8 −7 View lib/repo/handler/extras/repo_extra.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,30 +12,30 @@
1112 get,
1213 path = "/repo/{channel_id}/{repo_id}/issue_config",
1314 tag = "repo",
14 responses((status = 200, description = "Get issue config", body = IssueConfig)),
15 responses((status = 200, description = "Get issue config", body = AppResponseData<IssueConfig>)),
1516 security(("bearer_auth" = []))
1617)]
1718pub(crate) async fn get_handler(
1819 State(svc): State<RepoService>,
1920 AuthUser { claims }: AuthUser,
2021 Path((_, repo_id)): Path<(Uuid, Uuid)>,
21) -> RepoResult<Json<IssueConfig>> {
22) -> RepoResult<AppResponseData<IssueConfig>> {
2223 let out = svc.get_issue_config(claims.sub, repo_id).await?;
23 Ok(Json(out))
24 Ok(AppResponseData::ok(out))
2425}
2526
2627#[utoipa::path(
2728 get,
2829 path = "/repo/{channel_id}/{repo_id}/issue_config/validate",
2930 tag = "repo",
30 responses((status = 200, description = "Validate issue config", body = IssueConfigValidation)),
31 responses((status = 200, description = "Validate issue config", body = AppResponseData<IssueConfigValidation>)),
3132 security(("bearer_auth" = []))
3233)]
3334pub(crate) async fn validate_handler(
3435 State(svc): State<RepoService>,
3536 AuthUser { claims }: AuthUser,
3637 Path((_, repo_id)): Path<(Uuid, Uuid)>,
37) -> RepoResult<Json<IssueConfigValidation>> {
38) -> RepoResult<AppResponseData<IssueConfigValidation>> {
3839 let out = svc.validate_issue_config(claims.sub, repo_id).await?;
39 Ok(Json(out))
40 Ok(AppResponseData::ok(out))
4041}