From 40e1efa81f04d81f08d389170781362abe1ec0b3 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Thu, 18 Dec 2025 13:43:56 +0000 Subject: [PATCH] Merged in feat/SW-3688-nerbyhotels (pull request #3372) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(SW-3688): remove nearbyHotels prop/fetch from hotelscheme * feat(SW-3688): remove nearbyHotels prop/fetch from hotelscheme * Cleanup Approved-by: Joakim Jäderberg --- packages/trpc/lib/routers/hotels/output.ts | 12 +--------- .../routers/hotels/schemas/hotel/include.ts | 3 --- .../schemas/hotel/include/nearbyHotels.ts | 23 ------------------- .../lib/routers/hotels/services/getHotel.ts | 1 - packages/trpc/lib/types/hotel.ts | 4 ---- 5 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts diff --git a/packages/trpc/lib/routers/hotels/output.ts b/packages/trpc/lib/routers/hotels/output.ts index 533f61e67..3148ffd6c 100644 --- a/packages/trpc/lib/routers/hotels/output.ts +++ b/packages/trpc/lib/routers/hotels/output.ts @@ -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, } diff --git a/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts index 65bce9681..706c5bb18 100644 --- a/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts @@ -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, diff --git a/packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts deleted file mode 100644 index 7b37c4e7b..000000000 --- a/packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts +++ /dev/null @@ -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"), -}) diff --git a/packages/trpc/lib/routers/hotels/services/getHotel.ts b/packages/trpc/lib/routers/hotels/services/getHotel.ts index 5d89ff777..21854b488 100644 --- a/packages/trpc/lib/routers/hotels/services/getHotel.ts +++ b/packages/trpc/lib/routers/hotels/services/getHotel.ts @@ -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)], diff --git a/packages/trpc/lib/types/hotel.ts b/packages/trpc/lib/types/hotel.ts index f28913808..b8f97a5ae 100644 --- a/packages/trpc/lib/types/hotel.ts +++ b/packages/trpc/lib/types/hotel.ts @@ -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 export type HotelContent = z.output export type HotelLocation = z.output export type HotelRatings = z.output -type NearbyHotelsSchema = z.output -export type NearbyHotel = Pick & - NearbyHotelsSchema["attributes"] export type Parking = z.output export type PointOfInterest = z.output type RestaurantSchema = z.output