This commit is contained in:
yohlo
2025-08-20 22:35:40 -05:00
commit f51c278cd3
169 changed files with 8173 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
import { z } from "zod";
export interface Match {
id: string;
order: number;
lid: number;
reset: boolean;
round: number;
home_cups: number;
away_cups: number;
ot_count: number;
start_time: string;
end_time: string;
bye: boolean;
home_from_lid: number;
away_from_lid: number;
home_from_loser: boolean;
away_from_loser: boolean;
bracket_type: 'winners' | 'losers';
tournament_id: string;
home_id: string;
away_id: string;
created: string;
updated: string;
}
export const matchInputSchema = z.object({
order: z.number().int().min(1).optional(),
lid: z.number().int().min(1),
reset: z.boolean().optional().default(false),
round: z.number().int().min(1),
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(),
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),
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"] }
);
export type MatchInput = z.infer<typeof matchInputSchema>;
export type MatchUpdateInput = Partial<MatchInput>;