refactor(user): refresh profile public_view handler
zhenyi committed
Modified lib/user/handler/profile/public_view.rs lib/user/handler/profile/public_view.rs +4 −4 View lib/user/handler/profile/public_view.rs
@@ -1,5 +1,5 @@
1use axum::Json;
21use axum::extract::{Path, State};
2use export::data::AppResponseData;
33use jwt::extractor::AuthOptional;
44use uuid::Uuid;
55
@@ -16,7 +16,7 @@
1616 ("uid" = Uuid, Path, description = "User identifier."),
1717 ),
1818 responses(
19 (status = 200, description = "Public view of the user (visibility-filtered).", body = UserPublic),
19 (status = 200, description = "Public view of the user (visibility-filtered).", body = AppResponseData<UserPublic>),
2020 (status = 404, description = "User not found."),
2121 ),
2222)]
@@ -24,7 +24,7 @@
2424 State(svc): State<UserService>,
2525 AuthOptional(opt): AuthOptional,
2626 Path(uid): Path<Uuid>,
27) -> UserResult<Json<UserPublic>> {
27) -> UserResult<AppResponseData<UserPublic>> {
2828 let viewer = opt.map(|u| u.claims.sub);
2929 let public = svc
3030 .get_user_public(uid, viewer)
@@ -33,5 +33,5 @@
3333 UserError::NotFound(_) => UserError::NotFound(format!("user {uid}")),
3434 other => other,
3535 })?;
36 Ok(Json(public))
36 Ok(AppResponseData::ok(public))
3737}
No newline at end of file