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:
Lasse Rune Hansen 2026-06-14 09:19:11 +02:00
parent ab811dc851
commit 82df791907

View file

@ -100,8 +100,8 @@ public class StoryController : ControllerBase
if (!segments.Any())
{
_logger.LogWarning("No story segments found for level {LevelId}", levelId);
return NotFound();
_logger.LogInformation("No story segments found for level {LevelId}", levelId);
return Ok(new List<StorySegmentDto>()); // Return empty list instead of NotFound
}
return Ok(segments);