@@ -164,8 +164,16 @@ public ApiOkResponse ResetUserPlanetsByUsername(RequestContext context, GameData
164164
165165 [ ApiV3Endpoint ( "admin/users/{idType}/{id}" , HttpMethods . Patch ) , MinimumRole ( GameUserRole . Moderator ) ]
166166 [ DocSummary ( "Updates the specified user's profile with the given data" ) ]
167+ [ DocError ( typeof ( ApiNotFoundError ) , ApiNotFoundError . UserMissingErrorWhen ) ]
168+ [ DocError ( typeof ( ApiValidationError ) , ApiValidationError . MayNotOverwriteRoleErrorWhen ) ]
169+ [ DocError ( typeof ( ApiValidationError ) , ApiValidationError . RoleMissingErrorWhen ) ]
170+ [ DocError ( typeof ( ApiValidationError ) , ApiValidationError . WrongRoleUpdateMethodErrorWhen ) ]
171+ [ DocError ( typeof ( ApiNotFoundError ) , ApiNotFoundError . IconMissingErrorWhen ) ]
172+ [ DocError ( typeof ( ApiValidationError ) , ApiValidationError . InvalidUsernameErrorWhen ) ]
167173 public ApiResponse < ApiExtendedGameUserResponse > UpdateUser ( RequestContext context , GameDatabaseContext database ,
168- GameUser user , ApiAdminUpdateUserRequest body , DataContext dataContext , string idType , string id )
174+ GameUser user , ApiAdminUpdateUserRequest body , DataContext dataContext ,
175+ [ DocSummary ( "The type of identifier used to look up the user. Can be either 'uuid' or 'username'." ) ] string idType ,
176+ [ DocSummary ( "The UUID or username of the user, depending on the specified ID type." ) ] string id )
169177 {
170178 GameUser ? targetUser = database . GetUserByIdAndType ( idType , id ) ;
171179
@@ -190,20 +198,19 @@ public ApiResponse<ApiExtendedGameUserResponse> UpdateUser(RequestContext contex
190198 }
191199
192200 if ( body . IconHash != null && database . GetAssetFromHash ( body . IconHash ) == null )
193- return ApiNotFoundError . Instance ;
201+ return ApiNotFoundError . IconMissingError ;
194202
195203 if ( body . VitaIconHash != null && database . GetAssetFromHash ( body . VitaIconHash ) == null )
196- return ApiNotFoundError . Instance ;
204+ return ApiNotFoundError . IconMissingError ;
197205
198206 if ( body . BetaIconHash != null && database . GetAssetFromHash ( body . BetaIconHash ) == null )
199- return ApiNotFoundError . Instance ;
207+ return ApiNotFoundError . IconMissingError ;
200208
201- if ( body . Username != null ) {
209+ if ( body . Username != null )
210+ {
202211 if ( ! database . IsUsernameValid ( body . Username ) )
203- return new ApiValidationError (
204- "The username must be valid. " +
205- "The requirements are 3 to 16 alphanumeric characters, plus hyphens and underscores. " +
206- "Are you sure you used a PSN/RPCN username?" ) ;
212+ return new ApiValidationError ( ApiValidationError . InvalidUsernameErrorWhen
213+ + " Are you sure you used a PSN/RPCN username?" ) ;
207214
208215 database . RenameUser ( targetUser , body . Username ) ;
209216 }
0 commit comments