This repository was archived by the owner on Sep 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
crates/handlers/src/admin/v1/users Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,10 @@ impl IntoResponse for RouteError {
96
96
}
97
97
}
98
98
99
+ /// # JSON payload for the `POST /api/admin/v1/users` endpoint
99
100
#[ derive( Deserialize , JsonSchema ) ]
100
- pub struct AddUserParams {
101
+ #[ schemars( rename = "AddUserPayload" ) ]
102
+ pub struct Payload {
101
103
/// The username of the user to add.
102
104
username : String ,
103
105
@@ -141,7 +143,7 @@ pub async fn handler(
141
143
} : CallContext ,
142
144
NoApi ( mut rng) : NoApi < BoxRng > ,
143
145
State ( homeserver) : State < BoxHomeserverConnection > ,
144
- Json ( params) : Json < AddUserParams > ,
146
+ Json ( params) : Json < Payload > ,
145
147
) -> Result < Json < SingleResponse < User > > , RouteError > {
146
148
if repo. user ( ) . exists ( & params. username ) . await ? {
147
149
return Err ( RouteError :: UserAlreadyExists ) ;
Original file line number Diff line number Diff line change 177
177
"content" : {
178
178
"application/json" : {
179
179
"schema" : {
180
- "$ref" : " #/components/schemas/AddUserParams "
180
+ "$ref" : " #/components/schemas/AddUserPayload "
181
181
}
182
182
}
183
183
},
661
661
}
662
662
}
663
663
},
664
- "AddUserParams" : {
664
+ "AddUserPayload" : {
665
+ "title" : " JSON payload for the `POST /api/admin/v1/users` endpoint" ,
665
666
"type" : " object" ,
666
667
"required" : [
667
668
" username"
You can’t perform that action at this time.
0 commit comments