feat(SW-2547): filter out nonActive and nonPublished hotels and cities
This commit is contained in:
committed by
Michael Zetterberg
parent
814a1c534b
commit
e38fceb237
@@ -566,6 +566,7 @@ export const getHotelIdsSchema = z
|
||||
z.object({
|
||||
attributes: z.object({
|
||||
isPublished: z.boolean(),
|
||||
isActive: z.boolean(),
|
||||
}),
|
||||
id: z.string(),
|
||||
})
|
||||
@@ -573,7 +574,7 @@ export const getHotelIdsSchema = z
|
||||
})
|
||||
.transform(({ data }) => {
|
||||
const filteredHotels = data.filter(
|
||||
(hotel) => !!hotel.attributes.isPublished
|
||||
(hotel) => !!hotel.attributes.isPublished && !!hotel.attributes.isActive
|
||||
)
|
||||
return filteredHotels.map((hotel) => hotel.id)
|
||||
})
|
||||
@@ -582,12 +583,20 @@ export const getNearbyHotelIdsSchema = z
|
||||
.object({
|
||||
data: z.array(
|
||||
z.object({
|
||||
// We only care about the hotel id
|
||||
attributes: z.object({
|
||||
isPublished: z.boolean(),
|
||||
isActive: z.boolean(),
|
||||
}),
|
||||
id: z.string(),
|
||||
})
|
||||
),
|
||||
})
|
||||
.transform((data) => data.data.map((hotel) => hotel.id))
|
||||
.transform(({ data }) => {
|
||||
const filteredHotels = data.filter(
|
||||
(hotel) => !!hotel.attributes.isPublished && !!hotel.attributes.isActive
|
||||
)
|
||||
return filteredHotels.map((hotel) => hotel.id)
|
||||
})
|
||||
|
||||
export const roomFeaturesSchema = z
|
||||
.object({
|
||||
|
||||
Reference in New Issue
Block a user