fix(backend/api): Return empty array instead of 404 when no story segments exist
- GetSegmentsByLevelAsync now returns Ok([]) instead of NotFound() when no segments exist - Prevents frontend from throwing errors when database has no story segments - More RESTful: 200 with empty array vs 404 for non-existence Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
ab811dc851
commit
82df791907
1 changed files with 2 additions and 2 deletions
|
|
@ -100,8 +100,8 @@ public class StoryController : ControllerBase
|
||||||
|
|
||||||
if (!segments.Any())
|
if (!segments.Any())
|
||||||
{
|
{
|
||||||
_logger.LogWarning("No story segments found for level {LevelId}", levelId);
|
_logger.LogInformation("No story segments found for level {LevelId}", levelId);
|
||||||
return NotFound();
|
return Ok(new List<StorySegmentDto>()); // Return empty list instead of NotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(segments);
|
return Ok(segments);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue