123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { z } from "zod";
- import { GameShema } from "../game-shema.js";
- class siteApiShema {
- // /bookings/get-today-bookings
- public ZGetTodayBookings = {
- res: z.array(
- z.object({
- booking_id: z.number(),
- customer_phone: z.string().nullable(),
- customer_name: z.string().nullable(),
- customer_email: z.string().nullable(),
- game_id: z.string().nullable(),
- size: z.number(),
- booking_timestamp: z.string(),
- game_start: z.string(),
- game_end: z.string(),
- players_number: z.number(),
- }),
- ),
- };
- // /bookings/get-booking
- public ZGetBooking = {
- req: z.object({ booking_id: z.number() }),
- res: z.object({
- booking_id: z.number(),
- customer_phone: z.string().nullable(),
- customer_name: z.string().nullable(),
- customer_email: z.string().nullable(),
- game_id: GameShema.Z_GAMES_TYPES.nullable(),
- size: z.number(),
- booking_timestamp: z.string(),
- game_start: z.string(),
- game_end: z.string(),
- players_number: z.number(),
- }),
- };
- // /booking/change-booking
- public ZChangeBooking = {
- req: z.object({
- booking_id: z.number(),
- size: z.number(),
- }),
- res: z.object({
- booking_id: z.number(),
- game_id: GameShema.Z_GAMES_TYPES,
- size: z.number(),
- game_start: z.string(),
- game_end: z.string(),
- }),
- };
- // booking/book
- public ZBook = {
- req: z.object({
- gameStart: z.string(),
- size: z.number(),
- playersNumber: z.number(),
- isHotBooking: z.boolean().optional(),
- }),
- res: z.object({
- code: z.enum(["occupied", "sucsess", "error"]),
- booking: z
- .object({
- booking_id: z.number(),
- size: z.number(),
- game_start: z.string(),
- game_end: z.string(),
- players_number: z.number(),
- })
- .optional(),
- }),
- };
- //
- public ZGetGames = {
- res: z.array(
- z.object({
- game_id: GameShema.Z_GAMES_TYPES,
- name: z.string(),
- active: z.boolean(),
- min_players_number: z.number().min(1).max(8),
- max_players_number: z.number().min(1).max(8),
- }),
- ),
- };
- }
- export default new siteApiShema();
|