Merged in fix/destinations-speed-test (pull request #1704)
Feat(destination pages): Performance improvements * fix/destinations: try cache full response * Added more caching * Removed unsed env car * wip * merge master * wip * wip * wip * Renaming Approved-by: Michael Zetterberg
This commit is contained in:
@@ -12,6 +12,10 @@ import {
|
||||
includedSchema,
|
||||
relationshipsSchema as hotelRelationshipsSchema,
|
||||
} from "./schemas/hotel"
|
||||
import { addressSchema } from "./schemas/hotel/address"
|
||||
import { detailedFacilitiesSchema } from "./schemas/hotel/detailedFacility"
|
||||
import { locationSchema } from "./schemas/hotel/location"
|
||||
import { imageSchema } from "./schemas/image"
|
||||
import { locationCitySchema } from "./schemas/location/city"
|
||||
import { locationHotelSchema } from "./schemas/location/hotel"
|
||||
import {
|
||||
@@ -657,3 +661,40 @@ export const roomFeaturesSchema = z
|
||||
.transform((data) => {
|
||||
return data.data.attributes.roomFeatures
|
||||
})
|
||||
|
||||
export const destinationPagesHotelDataSchema = z
|
||||
.object({
|
||||
data: z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
location: locationSchema,
|
||||
cityIdentifier: z.string().optional(),
|
||||
tripadvisor: z.number().optional(),
|
||||
detailedFacilities: detailedFacilitiesSchema,
|
||||
galleryImages: z
|
||||
.array(imageSchema)
|
||||
.nullish()
|
||||
.transform((arr) => (arr ? arr.filter(Boolean) : [])),
|
||||
address: addressSchema,
|
||||
hotelType: z.string(),
|
||||
type: z.literal("hotels"), // No enum here but the standard return appears to be "hotels".
|
||||
url: z.string().optional(),
|
||||
hotelContent: z
|
||||
.object({
|
||||
texts: z.object({
|
||||
descriptions: z.object({
|
||||
short: z.string().optional(),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
.optional(),
|
||||
}),
|
||||
})
|
||||
.transform(({ data: { ...data } }) => {
|
||||
return {
|
||||
hotel: {
|
||||
...data,
|
||||
},
|
||||
url: data.url ?? "",
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user