feat(SW-200): Added other options for description and images

This commit is contained in:
Erik Tiekstra
2024-11-14 15:02:45 +01:00
parent b22888db5f
commit 6aba0d8f52
10 changed files with 137 additions and 60 deletions

View File

@@ -1,7 +1,10 @@
import { z } from "zod"
import { tempImageVaultAssetSchema } from "../schemas/imageVault"
import { getDescription, getImages, getTitle } from "./utils"
import { RTETypeEnum } from "@/types/rte/enums"
export const rawMetaDataDataSchema = z.object({
web: z.object({
seo_metadata: z
@@ -14,6 +17,10 @@ export const rawMetaDataDataSchema = z.object({
z.object({
node: z.object({
url: z.string(),
dimension: z.object({
width: z.number(),
height: z.number(),
}),
}),
})
),
@@ -39,6 +46,36 @@ export const rawMetaDataDataSchema = z.object({
})
.optional()
.nullable(),
hero_image: tempImageVaultAssetSchema,
blocks: z
.array(
z.object({
content: z
.object({
content: z
.object({
json: z.object({
children: z.array(
z.object({
type: z.nativeEnum(RTETypeEnum),
children: z.array(
z.object({
text: z.string().optional().nullable(),
})
),
})
),
}),
})
.optional()
.nullable(),
})
.optional()
.nullable(),
})
)
.optional()
.nullable(),
})
export const metaDataSchema = rawMetaDataDataSchema.transform((data) => {