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