Skip to content
Clone

refactor(repo): refresh contents get handler

zhenyi committed
parent 6a40469 commit 89724cd Browse files

1 file changed

+5 −4

Modified lib/repo/handler/contents/get.rs View lib/repo/handler/contents/get.rs
@@ -1,5 +1,6 @@
1use axum::Json;
21use axum::extract::{Path, Query, State};
2use export::data::AppResponseData;
3
34use jwt::extractor::AuthUser;
45use uuid::Uuid;
56
@@ -12,7 +13,7 @@
1213 path = "/repo/{channel_id}/{repo_id}/contents/{path}",
1314 tag = "repo",
1415 params(ContentsQuery),
15 responses((status = 200, description = "Get a file or directory", body = ContentsResponse)),
16 responses((status = 200, description = "Get a file or directory", body = AppResponseData<ContentsResponse>)),
1617 security(("bearer_auth" = []))
1718)]
1819pub(crate) async fn handler(
@@ -20,7 +21,7 @@
2021 AuthUser { claims }: AuthUser,
2122 Path((_, repo_id, path)): Path<(Uuid, Uuid, String)>,
2223 Query(q): Query<ContentsQuery>,
23) -> RepoResult<Json<ContentsResponse>> {
24) -> RepoResult<AppResponseData<ContentsResponse>> {
2425 let resp = svc.get_contents(claims.sub, repo_id, &path, q).await?;
25 Ok(Json(resp))
26 Ok(AppResponseData::ok(resp))
2627}