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