fix: change GAME_ROUNDS from strings to numbers

This commit is contained in:
lila 2026-04-28 12:29:46 +02:00
parent 7d3c456efe
commit 02ccc88d24
8 changed files with 181 additions and 14 deletions

View file

@ -4,7 +4,7 @@ export type SupportedLanguageCode = (typeof SUPPORTED_LANGUAGE_CODES)[number];
export const SUPPORTED_POS = ["noun", "verb", "adjective", "adverb"] as const;
export type SupportedPos = (typeof SUPPORTED_POS)[number];
export const GAME_ROUNDS = ["3", "10"] as const;
export const GAME_ROUNDS = [3, 10] as const;
export type GameRounds = (typeof GAME_ROUNDS)[number];
export const CEFR_LEVELS = ["A1", "A2", "B1", "B2", "C1", "C2"] as const;

View file

@ -12,7 +12,7 @@ export const GameRequestSchema = z.object({
target_language: z.enum(SUPPORTED_LANGUAGE_CODES),
pos: z.enum(SUPPORTED_POS),
difficulty: z.enum(DIFFICULTY_LEVELS),
rounds: z.enum(GAME_ROUNDS),
rounds: z.literal(GAME_ROUNDS),
});
export type GameRequest = z.infer<typeof GameRequestSchema>;