feat(SW-176): add default values
This commit is contained in:
@@ -11,10 +11,10 @@ export const getAvailabilityInputSchema = z.object({
|
||||
roomStayStartDate: z.string(),
|
||||
roomStayEndDate: z.string(),
|
||||
adults: z.number(),
|
||||
children: z.number().optional(),
|
||||
promotionCode: z.string().optional(),
|
||||
reservationProfileType: z.string().optional(),
|
||||
attachedProfileId: z.string().optional(),
|
||||
children: z.number().optional().default(0),
|
||||
promotionCode: z.string().optional().default(""),
|
||||
reservationProfileType: z.string().optional().default(""),
|
||||
attachedProfileId: z.string().optional().default(""),
|
||||
})
|
||||
|
||||
export const getRatesInputSchema = z.object({
|
||||
|
||||
@@ -470,7 +470,7 @@ export const getHotelDataSchema = z.object({
|
||||
|
||||
const occupancySchema = z.object({
|
||||
adults: z.number(),
|
||||
children: z.number().optional(),
|
||||
children: z.number(),
|
||||
})
|
||||
|
||||
const bestPricePerStaySchema = z.object({
|
||||
@@ -512,7 +512,7 @@ const availabilitySchema = z.object({
|
||||
attributes: z.object({
|
||||
checkInDate: z.string(),
|
||||
checkOutDate: z.string(),
|
||||
occupancy: occupancySchema,
|
||||
occupancy: occupancySchema.optional(),
|
||||
status: z.string(),
|
||||
hotelId: z.number(),
|
||||
ratePlanSet: z.string().optional(),
|
||||
|
||||
@@ -235,17 +235,25 @@ export const hotelQueryRouter = router({
|
||||
reservationProfileType,
|
||||
attachedProfileId,
|
||||
} = input
|
||||
// TODO: remove undefined type from params
|
||||
|
||||
const params: Record<string, string | number> = {
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
attachedProfileId,
|
||||
}
|
||||
|
||||
availabilityCounter.add(1, {
|
||||
cityId,
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
})
|
||||
console.info(
|
||||
"api.hotels.availability start",
|
||||
@@ -267,6 +275,9 @@ export const hotelQueryRouter = router({
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
error_type: "http_error",
|
||||
error: JSON.stringify({
|
||||
status: apiResponse.status,
|
||||
@@ -296,6 +307,9 @@ export const hotelQueryRouter = router({
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
error_type: "validation_error",
|
||||
error: JSON.stringify(validateAvailabilityData.error),
|
||||
})
|
||||
@@ -313,6 +327,9 @@ export const hotelQueryRouter = router({
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
})
|
||||
console.info(
|
||||
"api.hotels.availability success",
|
||||
|
||||
Reference in New Issue
Block a user