Skip to content
Clone

refactor(user): refresh ssh_keys add_key handler

zhenyi committed
parent b65c923 commit 60045ac Browse files

1 file changed

+6 −6

Modified lib/user/handler/security/ssh_keys/add_key.rs View lib/user/handler/security/ssh_keys/add_key.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;
@@ -10,16 +10,16 @@
1010 post,
1111 path = "/user/me/ssh-keys",
1212 tag = "user",
13 request_body = AddSshKeyCmd,
13 request_body = AppRequestData<AddSshKeyCmd>,
1414 responses(
15 (status = 200, description = "SSH key added.", body = SshKeyView),
15 (status = 200, description = "SSH key added.", body = AppResponseData<SshKeyView>),
1616 ),
1717 security(("bearer_auth" = [])),
1818)]
1919pub(crate) async fn handler(
2020 State(svc): State<UserService>,
2121 AuthUser { claims }: AuthUser,
22 Json(cmd): Json<AddSshKeyCmd>,
23) -> UserResult<Json<SshKeyView>> {
24 Ok(Json(svc.add_ssh_key(claims.sub, cmd).await?))
22 cmd: AppRequest<AddSshKeyCmd>,
23) -> UserResult<AppResponseData<SshKeyView>> {
24 Ok(AppResponseData::ok(svc.add_ssh_key(claims.sub, cmd.into_inner()).await?))
2525}
No newline at end of file