Feat/SW-1519 remove deprecated hotel data from schema
* feat(SW-1519): Removed displayWebpage from hotel schema * feat(SW-1519): Removed gallery from hotel schema * feat(SW-1519): Removed conferencesAndMeetings from hotel schema * feat(SW-1519): Removed healthAndWellness from hotel schema * feat(SW-1519): Removed restaurantImages from hotel schema * feat(SW-1519): Removed restaurantsOverviewPage from hotel schema Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
This commit is contained in:
@@ -6,6 +6,7 @@ import { hotelreservation } from "@/constants/routes/hotelReservation"
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import { attributesSchema as hotelAttributesSchema } from "../../hotels/schemas/hotel"
|
||||
import { additionalDataAttributesSchema } from "../../hotels/schemas/hotel/include/additionalData"
|
||||
import { tempImageVaultAssetSchema } from "../schemas/imageVault"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
import { getDescription, getImage, getTitle } from "./utils"
|
||||
@@ -96,7 +97,11 @@ export const rawMetadataSchema = z.object({
|
||||
blocks: metaDataBlocksSchema,
|
||||
hotel_page_id: z.string().optional().nullable(),
|
||||
hotelData: hotelAttributesSchema
|
||||
.pick({ name: true, address: true, hotelContent: true, gallery: true })
|
||||
.pick({ name: true, address: true, hotelContent: true })
|
||||
.optional()
|
||||
.nullable(),
|
||||
additionalHotelData: additionalDataAttributesSchema
|
||||
.pick({ gallery: true })
|
||||
.optional()
|
||||
.nullable(),
|
||||
location: z.string().optional().nullable(),
|
||||
|
||||
@@ -248,7 +248,12 @@ export const metadataQueryRouter = router({
|
||||
|
||||
metadata = await getTransformedMetadata({
|
||||
...hotelPageData,
|
||||
hotelData: hotelData?.hotel,
|
||||
...(hotelData
|
||||
? {
|
||||
hotelData: hotelData?.hotel,
|
||||
additionalHotelData: hotelData?.additionalData,
|
||||
}
|
||||
: {}),
|
||||
})
|
||||
break
|
||||
case PageContentTypeEnum.startPage:
|
||||
|
||||
@@ -157,8 +157,8 @@ export function getImage(data: RawMetadataSchema) {
|
||||
const metadataImage = data.web?.seo_metadata?.seo_image
|
||||
const heroImage = data.hero_image || data.header?.hero_image
|
||||
const hotelImage =
|
||||
data.hotelData?.gallery?.heroImages?.[0] ||
|
||||
data.hotelData?.gallery?.smallerImages?.[0]
|
||||
data.additionalHotelData?.gallery?.heroImages?.[0] ||
|
||||
data.additionalHotelData?.gallery?.smallerImages?.[0]
|
||||
|
||||
// Currently we don't have the possibility to get smaller images from ImageVault (2024-11-15)
|
||||
if (metadataImage) {
|
||||
|
||||
Reference in New Issue
Block a user