Adding update endpoint for location, player, spawnable, and user
This commit is contained in:
@@ -26,6 +26,20 @@ public class UserController : ControllerBase
|
||||
return Ok(users);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> UpdateUser([FromQuery] string username, [FromBody] UpdateUserRequest req)
|
||||
{
|
||||
var user = await _userService.GetByUsernameAsync(username);
|
||||
if (user == null)
|
||||
return NotFound($"User '{username}' not found.");
|
||||
|
||||
user.Role = req.Role;
|
||||
user.Email = req.Email;
|
||||
await _userService.UpdateAsync(user);
|
||||
return Ok(user);
|
||||
}
|
||||
|
||||
// DELETE: /api/User?username=foo
|
||||
[HttpDelete]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
|
||||
Reference in New Issue
Block a user