fix(SW-194): adapt to separated ContentPage query

This commit is contained in:
Matilda Landström
2024-10-10 10:48:55 +02:00
parent b287e893c3
commit 48b0278448
3 changed files with 14 additions and 1 deletions

View File

@@ -165,6 +165,12 @@ export const contentPageSchema = z.object({
}), }),
}) })
export const contentPageSchemaBlocks = z.object({
content_page: z.object({
blocks: discriminatedUnionArray(blocksSchema.options).nullable(),
}),
})
/** REFS */ /** REFS */
const contentPageCardsRefs = z const contentPageCardsRefs = z
.object({ .object({

View File

@@ -18,7 +18,10 @@ import {
TrackingChannelEnum, TrackingChannelEnum,
type TrackingSDKPageData, type TrackingSDKPageData,
} from "@/types/components/tracking" } from "@/types/components/tracking"
import type { GetContentPageSchema } from "@/types/trpc/routers/contentstack/contentPage" import type {
GetContentPageSchema,
GetContentPageSchemaBlocks,
} from "@/types/trpc/routers/contentstack/contentPage"
export const contentPageQueryRouter = router({ export const contentPageQueryRouter = router({
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {

View File

@@ -4,6 +4,7 @@ import {
blocksSchema, blocksSchema,
contentPageRefsSchema, contentPageRefsSchema,
contentPageSchema, contentPageSchema,
contentPageSchemaBlocks,
sidebarSchema, sidebarSchema,
} from "@/server/routers/contentstack/contentPage/output" } from "@/server/routers/contentstack/contentPage/output"
@@ -16,6 +17,9 @@ export interface ContentPageRefs
export interface GetContentPageSchema export interface GetContentPageSchema
extends z.input<typeof contentPageSchema> {} extends z.input<typeof contentPageSchema> {}
export interface GetContentPageSchemaBlocks
extends z.input<typeof contentPageSchemaBlocks> {}
export interface ContentPage extends z.output<typeof contentPageSchema> {} export interface ContentPage extends z.output<typeof contentPageSchema> {}
export type Block = z.output<typeof blocksSchema> export type Block = z.output<typeof blocksSchema>