Unify CCS case management flow

This commit is contained in:
hz
2026-07-19 21:29:24 -05:00
parent dacf2b89b2
commit f12904bf73
13 changed files with 938 additions and 47 deletions
+16 -1
View File
@@ -27,6 +27,13 @@ public sealed class CcsController(CcsStore store, CcsRatingStore ratings) : Cont
catch (InvalidOperationException exception) { return Conflict(exception.Message); }
}
[HttpGet("active")]
public async Task<IActionResult> Active()
{
var attempt = await store.FindActiveAsync(UserId());
return attempt is null ? NoContent() : Ok(await store.ToResponseAsync(attempt));
}
[HttpGet("attempts/{id}")]
public async Task<IActionResult> Attempt(string id)
{
@@ -54,7 +61,15 @@ public sealed class CcsController(CcsStore store, CcsRatingStore ratings) : Cont
}
[HttpGet("history")]
public async Task<IActionResult> History([FromQuery] int limit = 50) => Ok(await store.HistoryAsync(UserId(), limit));
public async Task<IActionResult> History(
[FromQuery] int limit = 20,
[FromQuery] string status = "all",
[FromQuery] string sort = "newest",
[FromQuery] string? cursor = null)
{
try { return Ok(await store.HistoryAsync(UserId(), limit, status, sort, cursor)); }
catch (ArgumentException exception) { return BadRequest(exception.Message); }
}
[HttpGet("prediction")]
public async Task<IActionResult> Prediction() => Ok(await store.PredictionAsync(UserId()));