restarting brackets

This commit is contained in:
yohlo
2025-09-03 21:57:47 -05:00
parent 1a21171ae8
commit 2f6950ee9e
20 changed files with 307 additions and 230 deletions

View File

@@ -16,10 +16,10 @@ export interface Match {
away_from_lid: number;
home_from_loser: boolean;
away_from_loser: boolean;
is_losers_bracket: 'winners' | 'losers';
tournament_id: string;
home_id: string;
away_id: string;
is_losers_bracket: boolean;
tournament: string;
home: string;
away: string;
created: string;
updated: string;
}
@@ -32,26 +32,18 @@ export const matchInputSchema = z.object({
home_cups: z.number().int().min(0).optional().default(0),
away_cups: z.number().int().min(0).optional().default(0),
ot_count: z.number().int().min(0).optional().default(0),
start_time: z.iso.datetime("Invalid start time format").optional(),
end_time: z.iso.datetime("Invalid end time format").optional(),
start_time: z.iso.datetime().optional(),
end_time: z.iso.datetime().optional(),
bye: z.boolean().optional().default(false),
home_from_lid: z.number().int().min(1).optional(),
away_from_lid: z.number().int().min(1).optional(),
home_from_loser: z.boolean().optional().default(false),
away_from_loser: z.boolean().optional().default(false),
is_losers_bracket: z.boolean().optional().default(false),
tournament_id: z.string().min(1),
home_id: z.string().min(1).optional(),
away_id: z.string().min(1).optional(),
}).refine(
(data) => {
if (data.start_time && data.end_time) {
return new Date(data.start_time) < new Date(data.end_time);
}
return true;
},
{ message: "End time must be after start time", path: ["end_time"] }
);
tournament: z.string().min(1),
home: z.string().min(1).optional(),
away: z.string().min(1).optional(),
});
export type MatchInput = z.infer<typeof matchInputSchema>;
export type MatchUpdateInput = Partial<MatchInput>;