Unify CCS case management flow
This commit is contained in:
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user