Adding update endpoint for location, player, spawnable, and user
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user