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:
@@ -28,13 +28,7 @@ import { relationshipsSchema } from "./schemas/relationships"
|
|||||||
import { roomConfigurationSchema } from "./schemas/roomAvailability/configuration"
|
import { roomConfigurationSchema } from "./schemas/roomAvailability/configuration"
|
||||||
import { rateDefinitionSchema } from "./schemas/roomAvailability/rateDefinition"
|
import { rateDefinitionSchema } from "./schemas/roomAvailability/rateDefinition"
|
||||||
|
|
||||||
import type {
|
import type { AdditionalData, City, Restaurant, Room } from "../../types/hotel"
|
||||||
AdditionalData,
|
|
||||||
City,
|
|
||||||
NearbyHotel,
|
|
||||||
Restaurant,
|
|
||||||
Room,
|
|
||||||
} from "../../types/hotel"
|
|
||||||
import type { Product, RateDefinition } from "../../types/roomAvailability"
|
import type { Product, RateDefinition } from "../../types/roomAvailability"
|
||||||
|
|
||||||
// NOTE: Find schema at: https://aks-test.scandichotels.com/hotel/swagger/v1/index.html
|
// 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"
|
(inc): inc is AdditionalData => inc!.type === "additionalData"
|
||||||
) ?? ({} as AdditionalData)
|
) ?? ({} as AdditionalData)
|
||||||
const cities = included.filter((inc): inc is City => inc!.type === "cities")
|
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(
|
const restaurants = included.filter(
|
||||||
(inc): inc is Restaurant => inc!.type === "restaurants"
|
(inc): inc is Restaurant => inc!.type === "restaurants"
|
||||||
)
|
)
|
||||||
@@ -78,7 +69,6 @@ export const hotelSchema = z
|
|||||||
...data,
|
...data,
|
||||||
...attributes,
|
...attributes,
|
||||||
},
|
},
|
||||||
nearbyHotels,
|
|
||||||
restaurants,
|
restaurants,
|
||||||
roomCategories,
|
roomCategories,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
additionalDataSchema,
|
additionalDataSchema,
|
||||||
transformAdditionalData,
|
transformAdditionalData,
|
||||||
} from "./include/additionalData"
|
} from "./include/additionalData"
|
||||||
import { nearbyHotelsSchema } from "./include/nearbyHotels"
|
|
||||||
import { restaurantsSchema } from "./include/restaurants"
|
import { restaurantsSchema } from "./include/restaurants"
|
||||||
import {
|
import {
|
||||||
roomCategoriesSchema,
|
roomCategoriesSchema,
|
||||||
@@ -19,7 +18,6 @@ export const includeSchema = z
|
|||||||
z.discriminatedUnion("type", [
|
z.discriminatedUnion("type", [
|
||||||
additionalDataSchema,
|
additionalDataSchema,
|
||||||
citySchema,
|
citySchema,
|
||||||
nearbyHotelsSchema,
|
|
||||||
restaurantsSchema,
|
restaurantsSchema,
|
||||||
roomCategoriesSchema,
|
roomCategoriesSchema,
|
||||||
]),
|
]),
|
||||||
@@ -29,7 +27,6 @@ export const includeSchema = z
|
|||||||
case "additionalData":
|
case "additionalData":
|
||||||
return transformAdditionalData(data)
|
return transformAdditionalData(data)
|
||||||
case "cities":
|
case "cities":
|
||||||
case "hotels":
|
|
||||||
case "restaurants":
|
case "restaurants":
|
||||||
return {
|
return {
|
||||||
...data.attributes,
|
...data.attributes,
|
||||||
|
|||||||
@@ -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"),
|
|
||||||
})
|
|
||||||
@@ -39,7 +39,6 @@ export const getHotel = cache(
|
|||||||
const params = new URLSearchParams([
|
const params = new URLSearchParams([
|
||||||
["include", "AdditionalData"],
|
["include", "AdditionalData"],
|
||||||
["include", "City"],
|
["include", "City"],
|
||||||
["include", "NearbyHotels"],
|
|
||||||
["include", "Restaurants"],
|
["include", "Restaurants"],
|
||||||
["include", "RoomCategories"],
|
["include", "RoomCategories"],
|
||||||
["language", toApiLang(language)],
|
["language", toApiLang(language)],
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import type {
|
|||||||
transformAdditionalData,
|
transformAdditionalData,
|
||||||
} from "../routers/hotels/schemas/hotel/include/additionalData"
|
} from "../routers/hotels/schemas/hotel/include/additionalData"
|
||||||
import type { facilitySchema } from "../routers/hotels/schemas/hotel/include/additionalData/facility"
|
import type { facilitySchema } from "../routers/hotels/schemas/hotel/include/additionalData/facility"
|
||||||
import type { nearbyHotelsSchema } from "../routers/hotels/schemas/hotel/include/nearbyHotels"
|
|
||||||
import type {
|
import type {
|
||||||
openingHoursDetailsSchema,
|
openingHoursDetailsSchema,
|
||||||
openingHoursSchema,
|
openingHoursSchema,
|
||||||
@@ -56,9 +55,6 @@ export type HotelAddress = z.output<typeof addressSchema>
|
|||||||
export type HotelContent = z.output<typeof hotelContentSchema>
|
export type HotelContent = z.output<typeof hotelContentSchema>
|
||||||
export type HotelLocation = z.output<typeof locationSchema>
|
export type HotelLocation = z.output<typeof locationSchema>
|
||||||
export type HotelRatings = z.output<typeof ratingsSchema>
|
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 Parking = z.output<typeof parkingSchema>
|
||||||
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
|
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
|
||||||
type RestaurantSchema = z.output<typeof restaurantsSchema>
|
type RestaurantSchema = z.output<typeof restaurantsSchema>
|
||||||
|
|||||||
Reference in New Issue
Block a user