Skip to content
Clone

refactor(space): refresh spaces get handler

zhenyi committed
parent b4926cd commit 06c9829 Browse files

1 file changed

+4 −4

Modified lib/space/handler/spaces/get.rs View lib/space/handler/spaces/get.rs
@@ -1,18 +1,18 @@
1use axum::Json;
21use axum::extract::{Path, State};
32use jwt::extractor::AuthOptional;
43use uuid::Uuid;
4use export::data::AppResponseData;
55use crate::error::SpaceResult;
66use crate::features::SpaceService;
77use crate::features::spaces::SpaceView;
88
9#[utoipa::path(get, path = "/spaces/{sid}", tag = "space", responses((status = 200, description = "Get a space", body = SpaceView)))]
9#[utoipa::path(get, path = "/spaces/{sid}", tag = "space", responses((status = 200, description = "Get a space", body = AppResponseData<SpaceView>)))]
1010pub(crate) async fn handler(
1111 State(svc): State<SpaceService>,
1212 AuthOptional(opt): AuthOptional,
1313 Path(sid): Path<Uuid>,
14) -> SpaceResult<Json<SpaceView>> {
14) -> SpaceResult<AppResponseData<SpaceView>> {
1515 let caller = opt.map(|u| u.claims.sub);
1616 let view = svc.get_space(caller, sid).await?;
17 Ok(Json(view))
17 Ok(AppResponseData::ok(view))
1818}
No newline at end of file