Updating character location based on occupied tile
Deploy Promiscuity Auth API / deploy (push) Successful in 45s
Deploy Promiscuity Character API / deploy (push) Successful in 57s
Deploy Promiscuity Locations API / deploy (push) Successful in 44s
k8s smoke test / test (push) Successful in 7s

This commit is contained in:
2026-03-13 21:34:59 -05:00
parent 6ca0f306bb
commit e79f473ce4
8 changed files with 122 additions and 14 deletions
@@ -104,6 +104,31 @@ public class CharactersController : ControllerBase
return Ok(locations);
}
[HttpPut("{id}/coord")]
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> UpdateCoord(string id, [FromBody] UpdateCharacterCoordRequest req)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
if (string.IsNullOrWhiteSpace(userId))
return Unauthorized();
if (req.Coord is null)
return BadRequest("Coord required");
var allowAnyOwner = User.IsInRole("SUPER");
var character = await _characters.GetByIdAsync(id);
if (character is null)
return NotFound();
if (!allowAnyOwner && character.OwnerUserId != userId)
return Forbid();
character.Coord = req.Coord;
var updated = await _characters.UpdateCoordAsync(id, req.Coord);
if (!updated)
return NotFound();
return Ok(character);
}
[HttpDelete("{id}")]
[Authorize(Roles = "USER,SUPER")]
public async Task<IActionResult> Delete(string id)