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
+17
View File
@@ -33,6 +33,23 @@ public class SpawnableController : ControllerBase
return Ok(spawnable);
}
[HttpPut("{id}")]
[Authorize(Roles = "SUPER")]
public async Task<IActionResult> Update(string id, [FromBody] UpdateSpawnableRequest req)
{
var spawnable = await _spawnableService.GetByIdAsync(id);
if (spawnable == null)
return NotFound("Spawnable not found.");
spawnable.Name = req.Name.ToLower();
spawnable.SpawnRate = req.SpawnRate;
spawnable.CollectAction = req.CollectAction;
spawnable.CollectResults = req.CollectResults;
await _spawnableService.UpdateAsync(spawnable);
return Ok(spawnable);
}
[HttpGet]
[Authorize(Roles = "SUPER")]
public async Task<IActionResult> GetAll()