feat/SW-711-update-children-params (pull request #791)
Feat/SW-711 update children params * feat(SW-711): add new child params for availability * feat(SW-711): fix children schema * feat(SW-711): fix optional values * feat(SW-711): add children as parameter iff not undefined * feat(SW-711): add bedType enum * feat(SW-711): remove optional number type * feat(SW-711): fix wrong slash * feat(SW-711): remove optional Approved-by: Hrishikesh Vaipurkar
This commit is contained in:
@@ -11,7 +11,7 @@ export const getHotelsAvailabilityInputSchema = z.object({
|
||||
roomStayStartDate: z.string(),
|
||||
roomStayEndDate: z.string(),
|
||||
adults: z.number(),
|
||||
children: z.number().optional().default(0),
|
||||
children: z.string().optional(),
|
||||
promotionCode: z.string().optional().default(""),
|
||||
reservationProfileType: z.string().optional().default(""),
|
||||
attachedProfileId: z.string().optional().default(""),
|
||||
@@ -22,7 +22,7 @@ export const getRoomsAvailabilityInputSchema = z.object({
|
||||
roomStayStartDate: z.string(),
|
||||
roomStayEndDate: z.string(),
|
||||
adults: z.number(),
|
||||
children: z.number().optional().default(0),
|
||||
children: z.string().optional(),
|
||||
promotionCode: z.string().optional(),
|
||||
reservationProfileType: z.string().optional().default(""),
|
||||
attachedProfileId: z.string().optional().default(""),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BedTypeEnum } from "@/constants/booking"
|
||||
import { dt } from "@/lib/dt"
|
||||
import { toLang } from "@/server/utils"
|
||||
|
||||
@@ -458,9 +459,14 @@ export const getHotelDataSchema = z.object({
|
||||
included: z.array(roomSchema).optional(),
|
||||
})
|
||||
|
||||
export const childrenSchema = z.object({
|
||||
age: z.number(),
|
||||
bedType: z.nativeEnum(BedTypeEnum),
|
||||
})
|
||||
|
||||
const occupancySchema = z.object({
|
||||
adults: z.number(),
|
||||
children: z.number(),
|
||||
children: z.array(childrenSchema),
|
||||
})
|
||||
|
||||
const bestPricePerStaySchema = z.object({
|
||||
|
||||
@@ -312,13 +312,12 @@ export const hotelQueryRouter = router({
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
...(children && { children }),
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
attachedProfileId,
|
||||
language: apiLang,
|
||||
}
|
||||
|
||||
hotelsAvailabilityCounter.add(1, {
|
||||
cityId,
|
||||
roomStayStartDate,
|
||||
@@ -437,7 +436,7 @@ export const hotelQueryRouter = router({
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
...(children && { children }),
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
attachedProfileId,
|
||||
|
||||
Reference in New Issue
Block a user