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
+15
View File
@@ -93,6 +93,21 @@ public class PlayerController : ControllerBase
return Ok(player);
}
[HttpPut]
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> Update([FromBody] UpdatePlayerRequest req)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var player = await _playerService.GetByUserIdAsync(userId);
if (player == null)
return NotFound("Player not found.");
player.Name = req.Name;
player.Climbing = req.Climbing;
await _playerService.UpdateAsync(player);
return Ok(player);
}
[HttpDelete]
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> Delete()