sigame-api-shema.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { z } from "zod";
  2. import { DbShema } from "../../db-shema.js";
  3. class sigameApiShema {
  4. public ZSelectQuestion = {
  5. req: z.object({
  6. questionIdx: z.number(),
  7. categoryIdx: z.number(),
  8. }),
  9. };
  10. public ZPlayerAnswer = {
  11. req: z.object({
  12. isRightAnswer: z.boolean(),
  13. }),
  14. };
  15. public ZTypePlayerAnswer = {
  16. req: z.object({
  17. isRightAnswer: z.boolean(),
  18. }),
  19. };
  20. public ZCatSelectPlayer = {
  21. req: z.object({
  22. playerIdx: z.number(),
  23. }),
  24. };
  25. public ZAuctionPlayerBet = {
  26. req: z.object({
  27. bet: z.union([z.number().min(1), z.literal("AllIn"), z.literal("check")]),
  28. }),
  29. };
  30. public ZRemoveFinalCategory = {
  31. req: z.object({
  32. categoryId: DbShema.ZCategories.shape.category_id,
  33. }),
  34. };
  35. public ZGodChangePlayerScore = {
  36. req: z.object({
  37. playerIdx: z.number(),
  38. newScore: z.number(),
  39. }),
  40. };
  41. public ZFinalPlayerBet = {
  42. req: z.object({
  43. playerIdx: z.number(),
  44. bet: z.number(),
  45. }),
  46. };
  47. public ZFinalPlayerAnswer = {
  48. req: z.object({
  49. playerIdx: z.number(),
  50. newVal: z.string(),
  51. }),
  52. };
  53. public ZFinalPlayerEvaluation = {
  54. req: z.object({
  55. playerIdx: z.number(),
  56. isRight: z.boolean(),
  57. }),
  58. };
  59. public ZPLayerButtonIsPressed = {
  60. req: z.object({
  61. consoleIdx: z.number(),
  62. }),
  63. };
  64. }
  65. export const SigameApiShema = new sigameApiShema();