Skip to content
Clone

refactor(user): refresh profile update_profile handler

zhenyi committed
parent 69730eb commit 500e779 Browse files

1 file changed

+7 −7

Modified lib/user/handler/profile/update_profile.rs View lib/user/handler/profile/update_profile.rs
@@ -1,5 +1,5 @@
1use axum::Json;
21use axum::extract::State;
2use export::data::{AppRequest, AppRequestData, AppResponseData};
33use jwt::extractor::AuthUser;
44
55use crate::error::UserResult;
@@ -11,17 +11,17 @@
1111 patch,
1212 path = "/user/me/profile",
1313 tag = "user",
14 request_body = UpdateProfileCmd,
14 request_body = AppRequestData<UpdateProfileCmd>,
1515 responses(
16 (status = 200, description = "Updated self profile.", body = UserMe),
16 (status = 200, description = "Updated self profile.", body = AppResponseData<UserMe>),
1717 ),
1818 security(("bearer_auth" = [])),
1919)]
2020pub(crate) async fn handler(
2121 State(svc): State<UserService>,
2222 AuthUser { claims }: AuthUser,
23 Json(cmd): Json<UpdateProfileCmd>,
24) -> UserResult<Json<UserMe>> {
25 let user = svc.update_profile(claims.sub, claims.sub, cmd).await?;
26 Ok(Json(user))
23 cmd: AppRequest<UpdateProfileCmd>,
24) -> UserResult<AppResponseData<UserMe>> {
25 let user = svc.update_profile(claims.sub, claims.sub, cmd.into_inner()).await?;
26 Ok(AppResponseData::ok(user))
2727}
No newline at end of file