Move simulation history into profile

This commit is contained in:
hz
2026-07-14 21:38:03 -05:00
parent 52e82391ee
commit 3b946c2bc5
14 changed files with 312 additions and 68 deletions
@@ -53,6 +53,19 @@ public class ExamSimulationsController(ExamSimulationStore simulations) : Contro
return Ok(await simulations.GetCompletedAsync(UserId(), limit, cursor));
}
[HttpGet("history")]
public async Task<IActionResult> History([FromQuery] int limit = 20, [FromQuery] string? before = null)
{
DateTime? cursor = null;
if (!string.IsNullOrWhiteSpace(before))
{
if (!DateTime.TryParse(before, null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed))
return BadRequest("The simulation-history cursor is invalid.");
cursor = parsed;
}
return Ok(await simulations.GetHistoryAsync(UserId(), limit, cursor));
}
[HttpGet("{id}")]
public async Task<IActionResult> Get(string id)
{