Adding update endpoint for location, player, spawnable, and user

This commit is contained in:
hz
2025-06-09 10:23:43 -05:00
parent 7aa192d728
commit 44f57a1121
13 changed files with 174 additions and 0 deletions
+14
View File
@@ -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")]