Skip to content
Clone

refactor(user): refresh devices update_device handler

zhenyi committed
parent a912398 commit 18f7706 Browse files

1 file changed

+6 −6

Modified lib/user/handler/devices/update_device.rs View lib/user/handler/devices/update_device.rs
@@ -1,5 +1,5 @@
1use axum::Json;
21use axum::extract::{Path, State};
2use export::data::{AppRequest, AppRequestData, AppResponseData};
33use jwt::extractor::AuthUser;
44use uuid::Uuid;
55
@@ -12,9 +12,9 @@
1212 path = "/user/me/devices/{id}",
1313 tag = "user",
1414 params(("id" = Uuid, Path, description = "Device identifier.")),
15 request_body = UpdateDeviceCmd,
15 request_body = AppRequestData<UpdateDeviceCmd>,
1616 responses(
17 (status = 200, description = "Device updated.", body = DeviceView),
17 (status = 200, description = "Device updated.", body = AppResponseData<DeviceView>),
1818 ),
1919 security(("bearer_auth" = [])),
2020)]
@@ -22,7 +22,7 @@
2222 State(svc): State<UserService>,
2323 AuthUser { claims }: AuthUser,
2424 Path(id): Path<Uuid>,
25 Json(cmd): Json<UpdateDeviceCmd>,
26) -> UserResult<Json<DeviceView>> {
27 Ok(Json(svc.update_device(claims.sub, id, cmd).await?))
25 cmd: AppRequest<UpdateDeviceCmd>,
26) -> UserResult<AppResponseData<DeviceView>> {
27 Ok(AppResponseData::ok(svc.update_device(claims.sub, id, cmd.into_inner()).await?))
2828}
No newline at end of file