Files
web/server/routers/contentstack/contentPage/output.ts
2024-08-22 09:49:02 +02:00

31 lines
755 B
TypeScript

import { z } from "zod"
import { Lang } from "@/constants/languages"
import { ImageVaultAsset } from "@/types/components/imageVaultImage"
export const validateContentPageSchema = z.object({
content_page: z.object({
title: z.string(),
header: z.object({
heading: z.string(),
preamble: z.string(),
}),
hero_image: z.any().nullable(),
system: z.object({
uid: z.string(),
locale: z.nativeEnum(Lang),
created_at: z.string(),
updated_at: z.string(),
}),
}),
})
export type ContentPageDataRaw = z.infer<typeof validateContentPageSchema>
type ContentPageRaw = ContentPageDataRaw["content_page"]
export type ContentPage = Omit<ContentPageRaw, "hero_image"> & {
hero_image?: ImageVaultAsset
}