feat(SW-176): set up route

This commit is contained in:
Fredrik Thorsson
2024-08-28 13:44:48 +02:00
parent deb3151edc
commit 9112941026
3 changed files with 29 additions and 8 deletions

View File

@@ -510,16 +510,17 @@ const availabilitySchema = z.object({
data: z.array(
z.object({
attributes: z.object({
checkInDate: z.date(),
checkOutDate: z.date(),
occupancy: occupancySchema,
checkInDate: z.string(),
checkOutDate: z.string(),
occupancy: occupancySchema.optional(),
status: z.string(),
hotelId: z.number(),
ratePlanSet: z.string(),
bestPricePerStay: bestPricePerStaySchema,
bestPricePerNight: bestPricePerNightSchema,
ratePlanSet: z.string().optional(),
bestPricePerStay: bestPricePerStaySchema.optional(),
bestPricePerNight: bestPricePerNightSchema.optional(),
}),
relationships: linksSchema,
relationships: linksSchema.optional(),
type: z.string().optional(),
})
),
})

View File

@@ -41,6 +41,14 @@ const getHotelCounter = meter.createCounter("trpc.hotel.get")
const getHotelSuccessCounter = meter.createCounter("trpc.hotel.get-success")
const getHotelFailCounter = meter.createCounter("trpc.hotel.get-fail")
const availabilityCounter = meter.createCounter("trpc.hotel.availability")
const availabilitySuccessCounter = meter.createCounter(
"trpc.hotel.availability-success"
)
const availabilityFailCounter = meter.createCounter(
"trpc.hotel.availability-fail"
)
async function getHotelId(locale: string, uid: string | null | undefined) {
const rawContentStackData = await request<HotelPageDataRaw>(GetHotelPage, {
locale,