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:
@@ -13,9 +13,6 @@ import { hotelContentSchema } from "./hotel/content"
|
||||
import { detailedFacilitiesSchema } from "./hotel/detailedFacility"
|
||||
import { hotelFactsSchema } from "./hotel/facts"
|
||||
import { healthFacilitiesSchema } from "./hotel/healthFacilities"
|
||||
import { displayWebPageSchema } from "./hotel/include/additionalData/displayWebPage"
|
||||
import { facilitySchema } from "./hotel/include/additionalData/facility"
|
||||
import { gallerySchema } from "./hotel/include/additionalData/gallery"
|
||||
import { includeSchema } from "./hotel/include/include"
|
||||
import { locationSchema } from "./hotel/location"
|
||||
import { merchantInformationSchema } from "./hotel/merchantInformation"
|
||||
@@ -31,17 +28,13 @@ export const attributesSchema = z.object({
|
||||
address: addressSchema,
|
||||
cityId: nullableStringValidator,
|
||||
cityName: nullableStringValidator,
|
||||
conferencesAndMeetings: facilitySchema.nullish(),
|
||||
contactInformation: contactInformationSchema,
|
||||
countryCode: nullableStringValidator,
|
||||
detailedFacilities: detailedFacilitiesSchema,
|
||||
displayWebPage: displayWebPageSchema,
|
||||
gallery: gallerySchema.nullish(),
|
||||
galleryImages: z
|
||||
.array(imageSchema)
|
||||
.nullish()
|
||||
.transform((arr) => (arr ? arr.filter(Boolean) : [])),
|
||||
healthAndWellness: facilitySchema.nullish(),
|
||||
healthFacilities: healthFacilitiesSchema,
|
||||
hotelContent: hotelContentSchema,
|
||||
hotelFacts: hotelFactsSchema,
|
||||
@@ -56,7 +49,6 @@ export const attributesSchema = z.object({
|
||||
parking: nullableArrayObjectValidator(parkingSchema),
|
||||
pointsOfInterest: pointOfInterestsSchema,
|
||||
ratings: ratingsSchema,
|
||||
restaurantImages: facilitySchema.nullish(),
|
||||
rewardNight: rewardNightSchema,
|
||||
socialMedia: socialMediaSchema,
|
||||
specialAlerts: specialAlertsSchema,
|
||||
|
||||
@@ -3,7 +3,6 @@ import { z } from "zod"
|
||||
import { nullableStringValidator } from "@/utils/zod/stringValidator"
|
||||
|
||||
import { imageSchema } from "../image"
|
||||
import { restaurantsOverviewPageSchema } from "./include/additionalData/restaurantsOverviewPage"
|
||||
|
||||
const descriptionSchema = z
|
||||
.object({
|
||||
@@ -21,6 +20,5 @@ const textsSchema = z.object({
|
||||
|
||||
export const hotelContentSchema = z.object({
|
||||
images: imageSchema,
|
||||
restaurantsOverviewPage: restaurantsOverviewPageSchema,
|
||||
texts: textsSchema,
|
||||
})
|
||||
|
||||
@@ -15,29 +15,31 @@ export const extraPageSchema = z.object({
|
||||
nameInUrl: nullableStringValidator,
|
||||
})
|
||||
|
||||
export const additionalDataAttributesSchema = z.object({
|
||||
accessibility: facilitySchema.nullish(),
|
||||
conferencesAndMeetings: facilitySchema.nullish(),
|
||||
displayWebPage: displayWebPageSchema,
|
||||
gallery: gallerySchema.nullish(),
|
||||
healthAndFitness: extraPageSchema,
|
||||
healthAndWellness: facilitySchema.nullish(),
|
||||
hotelParking: extraPageSchema,
|
||||
hotelRoomElevatorPitchText: nullableStringValidator,
|
||||
hotelSpecialNeeds: extraPageSchema,
|
||||
id: nullableStringValidator,
|
||||
meetingRooms: extraPageSchema.merge(
|
||||
z.object({
|
||||
meetingOnlineLink: z.string().nullish(),
|
||||
})
|
||||
),
|
||||
name: nullableStringValidator,
|
||||
parkingImages: facilitySchema.nullish(),
|
||||
restaurantImages: facilitySchema.nullish(),
|
||||
restaurantsOverviewPage: restaurantsOverviewPageSchema,
|
||||
specialNeedGroups: nullableArrayObjectValidator(specialNeedGroupSchema),
|
||||
})
|
||||
|
||||
export const additionalDataSchema = z.object({
|
||||
attributes: z.object({
|
||||
accessibility: facilitySchema.nullish(),
|
||||
conferencesAndMeetings: facilitySchema.nullish(),
|
||||
displayWebPage: displayWebPageSchema,
|
||||
gallery: gallerySchema.nullish(),
|
||||
healthAndFitness: extraPageSchema,
|
||||
healthAndWellness: facilitySchema.nullish(),
|
||||
hotelParking: extraPageSchema,
|
||||
hotelRoomElevatorPitchText: nullableStringValidator,
|
||||
hotelSpecialNeeds: extraPageSchema,
|
||||
id: nullableStringValidator,
|
||||
meetingRooms: extraPageSchema.merge(
|
||||
z.object({
|
||||
meetingOnlineLink: z.string().nullish(),
|
||||
})
|
||||
),
|
||||
name: nullableStringValidator,
|
||||
parkingImages: facilitySchema.nullish(),
|
||||
restaurantImages: facilitySchema.nullish(),
|
||||
restaurantsOverviewPage: restaurantsOverviewPageSchema,
|
||||
specialNeedGroups: nullableArrayObjectValidator(specialNeedGroupSchema),
|
||||
}),
|
||||
attributes: additionalDataAttributesSchema,
|
||||
type: z.literal("additionalData"),
|
||||
})
|
||||
|
||||
|
||||
@@ -2,29 +2,21 @@ import { z } from "zod"
|
||||
|
||||
import { attributesSchema } from "@/server/routers/hotels/schemas/hotel"
|
||||
|
||||
import { displayWebPageSchema } from "./additionalData/displayWebPage"
|
||||
|
||||
export const nearbyHotelsSchema = z.object({
|
||||
attributes: z.lazy(() =>
|
||||
z
|
||||
.object({
|
||||
displayWebPage: displayWebPageSchema,
|
||||
})
|
||||
.merge(
|
||||
attributesSchema.pick({
|
||||
address: true,
|
||||
cityId: true,
|
||||
cityName: true,
|
||||
detailedFacilities: true,
|
||||
hotelContent: true,
|
||||
isActive: true,
|
||||
isPublished: true,
|
||||
location: true,
|
||||
name: true,
|
||||
operaId: true,
|
||||
ratings: true,
|
||||
})
|
||||
)
|
||||
attributesSchema.pick({
|
||||
address: true,
|
||||
cityId: true,
|
||||
cityName: true,
|
||||
detailedFacilities: true,
|
||||
hotelContent: true,
|
||||
isActive: true,
|
||||
isPublished: true,
|
||||
location: true,
|
||||
name: true,
|
||||
operaId: true,
|
||||
ratings: true,
|
||||
})
|
||||
),
|
||||
id: z.string(),
|
||||
type: z.literal("hotels"),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user