Refactor phase reads to pure lookups and align admin docs

This commit is contained in:
2026-02-07 00:36:04 +01:00
parent fcd44de4e4
commit 81c04e0866
12 changed files with 124 additions and 42 deletions

View File

@@ -57,7 +57,7 @@ public static class AdminEndpoints
if (player is null)
return Results.NotFound(new { error = "Player not found." });
var phase = await EndpointHelpers.GetPhase(db, player.Id);
var phase = await EndpointHelpers.GetCurrentPhaseAsync(db, player.Id);
if (phase != Phase.Vote)
return Results.BadRequest(new { error = "Player must be in the Vote phase to receive a joker." });
@@ -108,7 +108,7 @@ public static class AdminEndpoints
if (player is null)
return Results.Unauthorized();
var phase = await EndpointHelpers.GetPhase(db, player.Id);
var phase = await EndpointHelpers.GetCurrentPhaseAsync(db, player.Id);
if (phase != Phase.Vote)
return EndpointHelpers.PhaseMismatch(Phase.Vote, phase);
@@ -172,7 +172,7 @@ public static class AdminEndpoints
if (player is null)
return Results.Unauthorized();
var phase = await EndpointHelpers.GetPhase(db, player.Id);
var phase = await EndpointHelpers.GetCurrentPhaseAsync(db, player.Id);
if (phase != Phase.Vote)
return EndpointHelpers.PhaseMismatch(Phase.Vote, phase);
@@ -260,3 +260,4 @@ public static class AdminEndpoints
});
}
}