Skip to content
Clone

refactor(repo): refresh extras commits handler

zhenyi committed
parent ccb3337 commit b63c9ba Browse files

1 file changed

+8 −7

Modified lib/repo/handler/extras/commits.rs View lib/repo/handler/extras/commits.rs
@@ -1,8 +1,9 @@
1use axum::Json;
21use axum::extract::{Path, Query, State};
32use axum::http::HeaderValue;
43use axum::http::header;
54use axum::response::{IntoResponse, Response};
5use export::data::AppResponseData;
6
67use jwt::extractor::AuthUser;
78use uuid::Uuid;
89
@@ -16,7 +17,7 @@
1617 path = "/repo/{channel_id}/{repo_id}/commits",
1718 tag = "repo",
1819 params(CommitsQuery),
19 responses((status = 200, description = "List commits", body = CommitsResponse)),
20 responses((status = 200, description = "List commits", body = AppResponseData<CommitsResponse>)),
2021 security(("bearer_auth" = []))
2122)]
2223pub(crate) async fn list_handler(
@@ -24,25 +25,25 @@
2425 AuthUser { claims }: AuthUser,
2526 Path((_, repo_id)): Path<(Uuid, Uuid)>,
2627 Query(q): Query<CommitsQuery>,
27) -> RepoResult<Json<CommitsResponse>> {
28) -> RepoResult<AppResponseData<CommitsResponse>> {
2829 let out = svc.list_commits(claims.sub, repo_id, q).await?;
29 Ok(Json(out))
30 Ok(AppResponseData::ok(out))
3031}
3132
3233#[utoipa::path(
3334 get,
3435 path = "/repo/{channel_id}/{repo_id}/git/commits/{sha}",
3536 tag = "repo",
36 responses((status = 200, description = "Get a commit", body = CommitSummary)),
37 responses((status = 200, description = "Get a commit", body = AppResponseData<CommitSummary>)),
3738 security(("bearer_auth" = []))
3839)]
3940pub(crate) async fn get_handler(
4041 State(svc): State<RepoService>,
4142 AuthUser { claims }: AuthUser,
4243 Path((_, repo_id, sha)): Path<(Uuid, Uuid, String)>,
43) -> RepoResult<Json<CommitSummary>> {
44) -> RepoResult<AppResponseData<CommitSummary>> {
4445 let out = svc.get_commit(claims.sub, repo_id, &sha).await?;
45 Ok(Json(out))
46 Ok(AppResponseData::ok(out))
4647}
4748
4849#[utoipa::path(