adding log camps

This commit is contained in:
hz
2026-05-18 20:42:49 -05:00
parent 3167558e04
commit bf75f02dbb
12 changed files with 365 additions and 35 deletions
@@ -113,6 +113,36 @@ public class LocationsController : ControllerBase
return Ok(LocationResponse.FromLocation(location));
}
[Authorize(Roles = "USER,SUPER")]
[HttpPost("build")]
public async Task<ActionResult<LocationResponse>> Build([FromBody] BuildLocationRequest request)
{
var username = User.FindFirstValue(ClaimTypes.Name);
if (string.IsNullOrWhiteSpace(username))
{
return Unauthorized();
}
try
{
var location = await _locations.BuildAsync(request, username);
if (location is null)
{
return NotFound("Build target must be controlled by the player.");
}
return Ok(LocationResponse.FromLocation(location));
}
catch (InvalidOperationException ex)
{
return BadRequest(ex.Message);
}
catch (ArgumentException ex)
{
return BadRequest(ex.Message);
}
}
[Authorize(Roles = "USER,SUPER")]
[HttpGet("home")]
public async Task<ActionResult<LocationResponse>> GetHome()