Merged in feat/support-for-all-page-links (pull request #1212)
Feat/support for all page links * feat: added all page link connections to queries * feat: updated output files Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import * as pageLinks from "@/server/routers/contentstack/schemas/pageLinks"
|
||||
|
||||
import { tempImageVaultAssetSchema } from "../schemas/imageVault"
|
||||
import {
|
||||
destinationCountryPageRefSchema,
|
||||
linkRefsUnionSchema,
|
||||
linkUnionSchema,
|
||||
transformPageLink,
|
||||
} from "../schemas/pageLinks"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
import type { ImageVaultAsset } from "@/types/components/imageVault"
|
||||
@@ -92,21 +96,13 @@ export const destinationCityPageSchema = z
|
||||
embedded_itemsConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z
|
||||
.discriminatedUnion("__typename", [
|
||||
pageLinks.accountPageSchema,
|
||||
pageLinks.contentPageSchema,
|
||||
pageLinks.hotelPageSchema,
|
||||
pageLinks.loyaltyPageSchema,
|
||||
pageLinks.collectionPageSchema,
|
||||
])
|
||||
.transform((data) => {
|
||||
const link = pageLinks.transform(data)
|
||||
if (link) {
|
||||
return link
|
||||
}
|
||||
return data
|
||||
}),
|
||||
node: linkUnionSchema.transform((data) => {
|
||||
const link = transformPageLink(data)
|
||||
if (link) {
|
||||
return link
|
||||
}
|
||||
return data
|
||||
}),
|
||||
})
|
||||
),
|
||||
}),
|
||||
@@ -153,7 +149,7 @@ export const destinationCityPageRefsSchema = z.object({
|
||||
countryConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: pageLinks.destinationCountryPageRefSchema,
|
||||
node: destinationCountryPageRefSchema,
|
||||
})
|
||||
),
|
||||
}),
|
||||
@@ -163,13 +159,7 @@ export const destinationCityPageRefsSchema = z.object({
|
||||
embedded_itemsConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z.discriminatedUnion("__typename", [
|
||||
pageLinks.accountPageRefSchema,
|
||||
pageLinks.contentPageRefSchema,
|
||||
pageLinks.hotelPageRefSchema,
|
||||
pageLinks.loyaltyPageRefSchema,
|
||||
pageLinks.collectionPageRefSchema,
|
||||
]),
|
||||
node: linkRefsUnionSchema,
|
||||
})
|
||||
),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user