mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-24 20:16:41 -05:00
Add isFinalized to api/tournament/:id
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user