feat: SW-276 Implemented child age validation
This commit is contained in:
@@ -2,6 +2,18 @@ import { z } from "zod"
|
||||
|
||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||
|
||||
export const guestRoomsSchema = z.array(
|
||||
z.object({
|
||||
adults: z.number().default(1),
|
||||
children: z.array(
|
||||
z.object({
|
||||
age: z.number().nonnegative(),
|
||||
bed: z.number(),
|
||||
})
|
||||
),
|
||||
})
|
||||
)
|
||||
|
||||
export const bookingWidgetSchema = z.object({
|
||||
bookingCode: z.string(), // Update this as required when working with booking codes component
|
||||
date: z.object({
|
||||
@@ -25,17 +37,7 @@ export const bookingWidgetSchema = z.object({
|
||||
{ message: "Required" }
|
||||
),
|
||||
redemption: z.boolean().default(false),
|
||||
rooms: z.array(
|
||||
z.object({
|
||||
adults: z.number().default(1),
|
||||
children: z.array(
|
||||
z.object({
|
||||
age: z.number(),
|
||||
bed: z.number(),
|
||||
})
|
||||
),
|
||||
})
|
||||
),
|
||||
rooms: guestRoomsSchema,
|
||||
search: z.string({ coerce: true }).min(1, "Required"),
|
||||
voucher: z.boolean().default(false),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user