feat(SW-176): add optional inputs
This commit is contained in:
@@ -223,17 +223,35 @@ export const hotelQueryRouter = router({
|
|||||||
get: serviceProcedure
|
get: serviceProcedure
|
||||||
.input(getAvailabilityInputSchema)
|
.input(getAvailabilityInputSchema)
|
||||||
.query(async ({ input, ctx }) => {
|
.query(async ({ input, ctx }) => {
|
||||||
const { cityId, roomStayStartDate, roomStayEndDate, adults } = input
|
const {
|
||||||
const params: Record<string, string | number> = {
|
cityId,
|
||||||
roomStayStartDate,
|
roomStayStartDate,
|
||||||
roomStayEndDate,
|
roomStayEndDate,
|
||||||
adults,
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
|
} = input
|
||||||
|
// TODO: remove undefined type from params
|
||||||
|
const params: Record<string, string | number | undefined> = {
|
||||||
|
roomStayStartDate,
|
||||||
|
roomStayEndDate,
|
||||||
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
}
|
}
|
||||||
availabilityCounter.add(1, {
|
availabilityCounter.add(1, {
|
||||||
cityId,
|
cityId,
|
||||||
roomStayStartDate,
|
roomStayStartDate,
|
||||||
roomStayEndDate,
|
roomStayEndDate,
|
||||||
adults,
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
})
|
})
|
||||||
console.info(
|
console.info(
|
||||||
"api.hotels.availability start",
|
"api.hotels.availability start",
|
||||||
@@ -256,6 +274,10 @@ export const hotelQueryRouter = router({
|
|||||||
roomStayStartDate,
|
roomStayStartDate,
|
||||||
roomStayEndDate,
|
roomStayEndDate,
|
||||||
adults,
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
error_type: "http_error",
|
error_type: "http_error",
|
||||||
error: JSON.stringify({
|
error: JSON.stringify({
|
||||||
status: apiResponse.status,
|
status: apiResponse.status,
|
||||||
@@ -285,6 +307,10 @@ export const hotelQueryRouter = router({
|
|||||||
roomStayStartDate,
|
roomStayStartDate,
|
||||||
roomStayEndDate,
|
roomStayEndDate,
|
||||||
adults,
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
error_type: "validation_error",
|
error_type: "validation_error",
|
||||||
error: JSON.stringify(validateAvailabilityData.error),
|
error: JSON.stringify(validateAvailabilityData.error),
|
||||||
})
|
})
|
||||||
@@ -302,6 +328,10 @@ export const hotelQueryRouter = router({
|
|||||||
roomStayStartDate,
|
roomStayStartDate,
|
||||||
roomStayEndDate,
|
roomStayEndDate,
|
||||||
adults,
|
adults,
|
||||||
|
children,
|
||||||
|
promotionCode,
|
||||||
|
reservationProfileType,
|
||||||
|
attachedProfileId,
|
||||||
})
|
})
|
||||||
console.info(
|
console.info(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
|||||||
Reference in New Issue
Block a user