Redesign exam and CCS experiences
This commit is contained in:
@@ -51,27 +51,33 @@ public class ExamSimulationsController(ExamSimulationStore simulations) : Contro
|
||||
[HttpGet("completed")]
|
||||
public async Task<IActionResult> Completed([FromQuery] int limit = 20, [FromQuery] string? before = null)
|
||||
{
|
||||
DateTime? cursor = null;
|
||||
DateTime? completedBefore = null;
|
||||
if (!string.IsNullOrWhiteSpace(before))
|
||||
{
|
||||
if (!DateTime.TryParse(before, null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed))
|
||||
return BadRequest("The completed-simulation cursor is invalid.");
|
||||
cursor = parsed;
|
||||
completedBefore = parsed;
|
||||
}
|
||||
return Ok(await simulations.GetCompletedAsync(UserId(), limit, cursor));
|
||||
return Ok(await simulations.GetCompletedAsync(UserId(), limit, completedBefore));
|
||||
}
|
||||
|
||||
[HttpGet("history")]
|
||||
public async Task<IActionResult> History([FromQuery] int limit = 20, [FromQuery] string? before = null)
|
||||
public async Task<IActionResult> History(
|
||||
[FromQuery] int limit = 20,
|
||||
[FromQuery] string status = "all",
|
||||
[FromQuery] string sort = "newest",
|
||||
[FromQuery] string? cursor = null,
|
||||
[FromQuery] string? before = null)
|
||||
{
|
||||
DateTime? cursor = null;
|
||||
DateTime? legacyBefore = 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;
|
||||
legacyBefore = parsed;
|
||||
}
|
||||
return Ok(await simulations.GetHistoryAsync(UserId(), limit, cursor));
|
||||
try { return Ok(await simulations.GetHistoryAsync(UserId(), limit, status, sort, cursor, legacyBefore)); }
|
||||
catch (ArgumentException exception) { return BadRequest(exception.Message); }
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
|
||||
Reference in New Issue
Block a user