Add isFinalized to api/tournament/:id
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2024-11-15 23:16:50 +02:00
parent 367d152aff
commit 68978a5c83
2 changed files with 9 additions and 1 deletions

View File

@@ -33,11 +33,16 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
"CalendarEventDate.eventId",
"CalendarEvent.id",
)
.select(({ eb }) => [
.select(({ eb, exists, selectFrom }) => [
"CalendarEvent.name",
"CalendarEvent.organizationId",
"CalendarEventDate.startTime",
"Tournament.settings",
exists(
selectFrom("TournamentResult")
.where("TournamentResult.tournamentId", "=", id)
.select("TournamentResult.tournamentId"),
).as("isFinalized"),
eb
.selectFrom("UserSubmittedImage")
.select(["UserSubmittedImage.url"])
@@ -80,6 +85,7 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
type: bp.type,
})),
organizationId: tournament.organizationId,
isFinalized: Boolean(tournament.isFinalized),
};
return await cors(request, json(result));

View File

@@ -85,6 +85,8 @@ export interface GetTournamentResponse {
};
brackets: TournamentBracket[];
organizationId: number | null;
/** Has the tournament concluded (results added to user profiles & no editing possible anymore) */
isFinalized: boolean;
}
/** GET /api/tournament/{tournamentId}/teams */