Merged in chore/remove-enrichHotel-call (pull request #3244)

Chore/remove enrichHotel call

* chore: remove enrichHotel api call

* include cityId when errors happen

* remove unused funciton and cleanup code

* tests no longer expect us to have called a function that is not used

* remove commented code


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-12-01 07:49:59 +00:00
parent 77ac3628c1
commit f6a807758e
10 changed files with 77 additions and 176 deletions

View File

@@ -27,8 +27,6 @@ import { addressSchema } from "./schemas/hotel/address"
import { detailedFacilitiesSchema } from "./schemas/hotel/detailedFacility"
import { locationSchema } from "./schemas/hotel/location"
import { imageSchema } from "./schemas/image"
import { locationCitySchema } from "./schemas/location/city"
import { locationHotelSchema } from "./schemas/location/hotel"
import { relationshipsSchema } from "./schemas/relationships"
import { roomConfigurationSchema } from "./schemas/roomAvailability/configuration"
import { rateDefinitionSchema } from "./schemas/roomAvailability/rateDefinition"
@@ -429,66 +427,6 @@ export const citiesSchema = z
return null
})
export const locationsSchema = z.object({
data: z
.array(
z
.discriminatedUnion("type", [locationCitySchema, locationHotelSchema])
.transform((location) => {
if (location.type === "cities") {
return {
...location.attributes,
country: location.attributes.countryName || "",
id: location.id,
type: location.type,
}
}
return {
...location.attributes,
id: location.id,
relationships: {
city: {
cityIdentifier: "",
ianaTimeZoneId: "",
id: "",
isPublished: false,
keywords: [],
name: "",
timeZoneId: "",
type: "cities",
url: location?.relationships?.city?.links?.related ?? "",
},
},
type: location.type,
operaId: location.attributes.operaId ?? "",
}
})
)
.transform((data) =>
data
.filter((node) => !!node && node.isPublished)
.filter((node) => {
if (node.type === "hotels") {
if (!node.operaId) {
return false
}
} else {
if (!node.cityIdentifier) {
return false
}
}
return true
})
.sort((a, b) => {
if (a.type === b.type) {
return a.name.localeCompare(b.name)
} else {
return a.type === "cities" ? -1 : 1
}
})
),
})
export type BreakfastPackages = z.output<typeof breakfastPackagesSchema>
export const breakfastPackagesSchema = z
.object({