Skip to content
Clone

refactor(repo): refresh topic search handler

zhenyi committed
parent bda53a3 commit 491f273 Browse files

1 file changed

+5 −4

Modified lib/repo/handler/topic/search.rs View lib/repo/handler/topic/search.rs
@@ -1,5 +1,6 @@
1use axum::Json;
21use axum::extract::{Query, State};
2use export::data::AppResponseData;
3
34use jwt::extractor::AuthUser;
45
56use crate::error::RepoResult;
@@ -11,14 +12,14 @@
1112 path = "/topics/search",
1213 tag = "repo",
1314 params(TopicSearchQuery),
14 responses((status = 200, description = "Search topics", body = TopicSearchResult)),
15 responses((status = 200, description = "Search topics", body = AppResponseData<TopicSearchResult>)),
1516 security(("bearer_auth" = []))
1617)]
1718pub(crate) async fn handler(
1819 State(svc): State<RepoService>,
1920 AuthUser { claims }: AuthUser,
2021 Query(q): Query<TopicSearchQuery>,
21) -> RepoResult<Json<TopicSearchResult>> {
22) -> RepoResult<AppResponseData<TopicSearchResult>> {
2223 let result = svc.search_topics(claims.sub, q).await?;
23 Ok(Json(result))
24 Ok(AppResponseData::ok(result))
2425}