Merged in fix/SW-1819-batching-city-urls (pull request #1477)

fix(SW-1819): Batching fetch for city page urls

* fix(SW-1819): Batching fetch for city page urls


Approved-by: Fredrik Thorsson
Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-03-05 10:15:52 +00:00
parent 6897e3bb0d
commit 76c20df8e8
10 changed files with 143 additions and 32 deletions

View File

@@ -74,14 +74,16 @@ export const destinationCityListDataSchema = z
})
.transform(
({ destination_experiences }) => destination_experiences
),
)
.nullish(),
images: z
.array(z.object({ image: tempImageVaultAssetSchema }))
.transform((images) =>
images
.map((image) => image.image)
.filter((image): image is ImageVaultAsset => !!image)
),
)
.nullish(),
url: z.string(),
system: systemSchema,
})
@@ -192,6 +194,14 @@ export const destinationCityPageSchema = z
}
})
export const cityPageCountSchema = z
.object({
all_destination_city_page: z.object({
total: z.number(),
}),
})
.transform(({ all_destination_city_page }) => all_destination_city_page.total)
export const cityPageUrlsSchema = z
.object({
all_destination_city_page: z.object({
@@ -213,6 +223,16 @@ export const cityPageUrlsSchema = z
})
.transform(({ all_destination_city_page }) => all_destination_city_page.items)
export const batchedCityPageUrlsSchema = z
.array(
z.object({
data: cityPageUrlsSchema,
})
)
.transform((allItems) => {
return allItems.flatMap((item) => item.data)
})
/** REFS */
const destinationCityPageContentRefs = z
.object({