Adding delete for spawnables
This commit is contained in:
@@ -40,4 +40,16 @@ public class SpawnableController : ControllerBase
|
||||
var all = await _spawnableService.GetAllAsync();
|
||||
return Ok(all);
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> Delete(string id)
|
||||
{
|
||||
var spawnable = await _spawnableService.GetByIdAsync(id);
|
||||
if (spawnable == null)
|
||||
return NotFound("Spawnable not found.");
|
||||
|
||||
await _spawnableService.DeleteAsync(id);
|
||||
return Ok($"Spawnable '{spawnable.Name}' deleted.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user