fix: set redeem description nullable in order to handle the transition from string to RTE

This commit is contained in:
Christian Andolf
2025-04-11 09:16:13 +02:00
parent 543ea3e5a3
commit 80a738af7b
2 changed files with 42 additions and 32 deletions

View File

@@ -36,22 +36,26 @@ const validateCmsRewardsSchema = z
reward_id: z.string(),
grouped_label: z.string().optional(),
description: z.string().optional(),
redeem_description: z.object({
json: z.any(), // JSON
embedded_itemsConnection: z.object({
edges: z.array(
z.object({
node: linkUnionSchema.transform((data) => {
const link = transformPageLink(data)
if (link) {
return link
}
return data
}),
})
),
}),
}),
redeem_description: z
.object({
json: z.any(), // JSON
embedded_itemsConnection: z.object({
edges: z.array(
z.object({
node: linkUnionSchema.transform((data) => {
const link = transformPageLink(data)
if (link) {
return link
}
return data
}),
})
),
}),
})
// This is primarily added in order to handle a transition
// switching from string to RTE
.nullable(),
grouped_description: z.string().optional(),
value: z.string().optional(),
})
@@ -66,15 +70,19 @@ const rewardRefsSchema = z.object({
all_reward: z.object({
items: z.array(
z.object({
redeem_description: z.object({
embedded_itemsConnection: z.object({
edges: z.array(
z.object({
node: linkRefsUnionSchema,
})
),
}),
}),
redeem_description: z
.object({
embedded_itemsConnection: z.object({
edges: z.array(
z.object({
node: linkRefsUnionSchema,
})
),
}),
})
// This is primarily added in order to handle a transition
// switching from string to RTE
.nullable(),
system: systemSchema,
})
),