Skip to content
Clone

refactor(space): refresh roles update handler

zhenyi committed
parent 0706065 commit 19f938b Browse files

1 file changed

+7 −7

Modified lib/space/handler/roles/update.rs View lib/space/handler/roles/update.rs
@@ -1,8 +1,8 @@
1use axum::Json;
21use axum::extract::{Path, State};
32use jwt::extractor::AuthUser;
43use uuid::Uuid;
54
5use export::data::{AppRequest, AppRequestData, AppResponseData};
66use crate::error::SpaceResult;
77use crate::features::SpaceService;
88use crate::features::roles::{RoleView, UpdateRoleCmd};
@@ -10,9 +10,9 @@
1010#[utoipa::path(
1111 patch,
1212 path = "/spaces/{sid}/roles/{rid}",
13 tag = "space",
13 tag = "space", request_body = AppRequestData<UpdateRoleCmd>,
1414 responses(
15 (status = 200, description = "Update a role", body = RoleView)
15 (status = 200, description = "Update a role", body = AppResponseData<RoleView>)
1616 ),
1717 security(("bearer_auth" = []))
1818)]
@@ -20,8 +20,8 @@
2020 State(svc): State<SpaceService>,
2121 AuthUser { claims }: AuthUser,
2222 Path((sid, rid)): Path<(Uuid, Uuid)>,
23 Json(cmd): Json<UpdateRoleCmd>,
24) -> SpaceResult<Json<RoleView>> {
25 let view = svc.update_role(claims.sub, sid, rid, cmd).await?;
26 Ok(Json(view))
23 cmd: AppRequest<UpdateRoleCmd>,
24) -> SpaceResult<AppResponseData<RoleView>> {
25 let view = svc.update_role(claims.sub, sid, rid, cmd.into_inner()).await?;
26 Ok(AppResponseData::ok(view))
2727}
No newline at end of file