Adding update endpoint for location, player, spawnable, and user
This commit is contained in:
@@ -45,6 +45,30 @@ public class LocationController : ControllerBase
|
||||
return Ok(newLoc);
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> Update(string id, [FromBody] UpdateLocationRequest req)
|
||||
{
|
||||
var location = await _locationService.GetByIdAsync(id);
|
||||
if (location == null)
|
||||
return NotFound("Location not found.");
|
||||
|
||||
location.X = req.X;
|
||||
location.Y = req.Y;
|
||||
location.Z = req.Z;
|
||||
location.N = req.N;
|
||||
location.NE = req.NE;
|
||||
location.E = req.E;
|
||||
location.SE = req.SE;
|
||||
location.S = req.S;
|
||||
location.SW = req.SW;
|
||||
location.W = req.W;
|
||||
location.NW = req.NW;
|
||||
|
||||
await _locationService.UpdateAsync(location);
|
||||
return Ok(location);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
|
||||
Reference in New Issue
Block a user