Adding delete for spawnables

This commit is contained in:
hz
2025-06-08 21:54:57 -05:00
parent 2ed8aaffc6
commit d16ecac876
3 changed files with 38 additions and 0 deletions
+12
View File
@@ -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.");
}
}