Merged in feat/SW-3688-nerbyhotels (pull request #3372)

feat(SW-3688): remove nearbyHotels prop/fetch from hotelscheme

* feat(SW-3688): remove nearbyHotels prop/fetch from hotelscheme

* Cleanup


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-12-18 13:43:56 +00:00
parent 6b08d5a113
commit 40e1efa81f
5 changed files with 1 additions and 42 deletions

View File

@@ -28,13 +28,7 @@ import { relationshipsSchema } from "./schemas/relationships"
import { roomConfigurationSchema } from "./schemas/roomAvailability/configuration"
import { rateDefinitionSchema } from "./schemas/roomAvailability/rateDefinition"
import type {
AdditionalData,
City,
NearbyHotel,
Restaurant,
Room,
} from "../../types/hotel"
import type { AdditionalData, City, Restaurant, Room } from "../../types/hotel"
import type { Product, RateDefinition } from "../../types/roomAvailability"
// NOTE: Find schema at: https://aks-test.scandichotels.com/hotel/swagger/v1/index.html
@@ -62,9 +56,6 @@ export const hotelSchema = z
(inc): inc is AdditionalData => inc!.type === "additionalData"
) ?? ({} as AdditionalData)
const cities = included.filter((inc): inc is City => inc!.type === "cities")
const nearbyHotels = included.filter(
(inc): inc is NearbyHotel => inc!.type === "hotels"
)
const restaurants = included.filter(
(inc): inc is Restaurant => inc!.type === "restaurants"
)
@@ -78,7 +69,6 @@ export const hotelSchema = z
...data,
...attributes,
},
nearbyHotels,
restaurants,
roomCategories,
}

View File

@@ -5,7 +5,6 @@ import {
additionalDataSchema,
transformAdditionalData,
} from "./include/additionalData"
import { nearbyHotelsSchema } from "./include/nearbyHotels"
import { restaurantsSchema } from "./include/restaurants"
import {
roomCategoriesSchema,
@@ -19,7 +18,6 @@ export const includeSchema = z
z.discriminatedUnion("type", [
additionalDataSchema,
citySchema,
nearbyHotelsSchema,
restaurantsSchema,
roomCategoriesSchema,
]),
@@ -29,7 +27,6 @@ export const includeSchema = z
case "additionalData":
return transformAdditionalData(data)
case "cities":
case "hotels":
case "restaurants":
return {
...data.attributes,

View File

@@ -1,23 +0,0 @@
import { z } from "zod"
import { attributesSchema } from "../../hotel"
export const nearbyHotelsSchema = z.object({
attributes: z.lazy(() =>
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"),
})

View File

@@ -39,7 +39,6 @@ export const getHotel = cache(
const params = new URLSearchParams([
["include", "AdditionalData"],
["include", "City"],
["include", "NearbyHotels"],
["include", "Restaurants"],
["include", "RoomCategories"],
["language", toApiLang(language)],

View File

@@ -24,7 +24,6 @@ import type {
transformAdditionalData,
} from "../routers/hotels/schemas/hotel/include/additionalData"
import type { facilitySchema } from "../routers/hotels/schemas/hotel/include/additionalData/facility"
import type { nearbyHotelsSchema } from "../routers/hotels/schemas/hotel/include/nearbyHotels"
import type {
openingHoursDetailsSchema,
openingHoursSchema,
@@ -56,9 +55,6 @@ export type HotelAddress = z.output<typeof addressSchema>
export type HotelContent = z.output<typeof hotelContentSchema>
export type HotelLocation = z.output<typeof locationSchema>
export type HotelRatings = z.output<typeof ratingsSchema>
type NearbyHotelsSchema = z.output<typeof nearbyHotelsSchema>
export type NearbyHotel = Pick<NearbyHotelsSchema, "id" | "type"> &
NearbyHotelsSchema["attributes"]
export type Parking = z.output<typeof parkingSchema>
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
type RestaurantSchema = z.output<typeof restaurantsSchema>