feat(shared): add quiz session Zod schemas

Add the shared schemas for the quiz request/response cycle, defining
the contract between the API and the frontend.

- Reorganise packages/shared: move schemas into a schemas/ subdirectory
  grouped by domain. Delete the old flat schema.ts.
- Add AnswerOption, GameQuestion, GameSession, AnswerSubmission, and
  AnswerResult alongside the existing GameRequest.
- optionId is an integer 0-3 (positional, shuffled at session-build
  time so position carries no information).
- questionId and sessionId are UUIDs (globally unique, opaque, natural
  keys for Valkey storage later).
- gloss is  rather than optional, for a predictable
  shape on the frontend.
- options array enforced to exactly 4 elements at the schema level.
This commit is contained in:
lila 2026-04-10 21:43:53 +02:00
parent 2bcf9d7a97
commit ce6dc4fa32
3 changed files with 58 additions and 19 deletions

View file

@ -1,2 +1,2 @@
export * from "./constants.js";
export * from "./schema.js";
export * from "./schemas/game.js";