feat(SW-302): switch out mock data for facility cards
This commit is contained in:
@@ -164,6 +164,16 @@ const detailedFacilitySchema = z.object({
|
||||
filter: z.string().optional(),
|
||||
})
|
||||
|
||||
const facilitySchema = z.object({
|
||||
headingText: z.string().optional(), // TODO: Should not be optional, remove when we get meetingsAndConferences headingText
|
||||
heroImages: z.array(
|
||||
z.object({
|
||||
metaData: imageMetaDataSchema,
|
||||
imageSizes: imageSizesSchema,
|
||||
})
|
||||
),
|
||||
})
|
||||
|
||||
const healthFacilitySchema = z.object({
|
||||
type: z.string(),
|
||||
content: z.object({
|
||||
@@ -497,6 +507,9 @@ export const getHotelDataSchema = z.object({
|
||||
socialMedia: socialMediaSchema,
|
||||
meta: metaSchema.optional(),
|
||||
isActive: z.boolean(),
|
||||
conferencesAndMeetings: facilitySchema.optional(),
|
||||
healthAndWellness: facilitySchema.optional(),
|
||||
restaurantImages: facilitySchema.optional(),
|
||||
}),
|
||||
relationships: relationshipsSchema,
|
||||
}),
|
||||
@@ -778,3 +791,4 @@ export const apiLocationsSchema = z.object({
|
||||
})
|
||||
),
|
||||
})
|
||||
export type Facility = z.infer<typeof facilitySchema> & { id: string }
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
getRatesInputSchema,
|
||||
} from "./input"
|
||||
import {
|
||||
Facility,
|
||||
getAvailabilitySchema,
|
||||
getHotelDataSchema,
|
||||
getRatesSchema,
|
||||
@@ -40,6 +41,7 @@ import {
|
||||
TWENTYFOUR_HOURS,
|
||||
} from "./utils"
|
||||
|
||||
import { facilityEnum } from "@/types/components/hotelPage/facilities"
|
||||
import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
||||
import type { RequestOptionsWithOutBody } from "@/types/fetch"
|
||||
import type { GetHotelPageData } from "@/types/trpc/routers/contentstack/hotelPage"
|
||||
@@ -173,7 +175,6 @@ export const hotelQueryRouter = router({
|
||||
const included = validatedHotelData.data.included || []
|
||||
|
||||
const hotelAttributes = validatedHotelData.data.data.attributes
|
||||
|
||||
const images = extractHotelImages(hotelAttributes)
|
||||
|
||||
const roomCategories = included
|
||||
@@ -212,6 +213,21 @@ export const hotelQueryRouter = router({
|
||||
? contentstackData?.content[0]
|
||||
: null
|
||||
|
||||
const facilities: Array<Facility> = [
|
||||
{
|
||||
...apiJson.data.attributes.restaurantImages,
|
||||
id: facilityEnum.restaurant,
|
||||
},
|
||||
{
|
||||
...apiJson.data.attributes.conferencesAndMeetings,
|
||||
id: facilityEnum.conference,
|
||||
},
|
||||
{
|
||||
...apiJson.data.attributes.healthAndWellness,
|
||||
id: facilityEnum.wellness,
|
||||
},
|
||||
]
|
||||
|
||||
getHotelSuccessCounter.add(1, { hotelId, lang, include })
|
||||
console.info(
|
||||
"api.hotels.hotel success",
|
||||
@@ -229,7 +245,8 @@ export const hotelQueryRouter = router({
|
||||
hotelImages: images,
|
||||
pointsOfInterest: hotelAttributes.pointsOfInterest,
|
||||
roomCategories,
|
||||
activitiesCard: activities?.upcoming_activities_card,
|
||||
activitiesCard: activities,
|
||||
facilityCards: facilities,
|
||||
}
|
||||
}),
|
||||
availability: router({
|
||||
|
||||
Reference in New Issue
Block a user