feat : update
This commit is contained in:
@@ -2,6 +2,7 @@ import * as z from "zod";
|
||||
|
||||
import { targetStatOptions } from "@/lib/guides/stats";
|
||||
import { parseYouTubeUrl } from "@/lib/guides/youtube";
|
||||
import { normalizeExtraRichText } from "@/lib/rich-text";
|
||||
|
||||
export const guideSectionKinds = ["weapon", "artifact", "constellations", "team"] as const;
|
||||
export type GuideSectionKind = (typeof guideSectionKinds)[number];
|
||||
@@ -136,7 +137,7 @@ const hexColor = z.string().regex(/^#[0-9a-fA-F]{6}$/, "กรุณาเลื
|
||||
const extraRowSchema = z.strictObject({
|
||||
mediaId: z.string().uuid().nullable(),
|
||||
heading: z.string().trim().min(1).max(200),
|
||||
body: z.string().trim().max(2_000),
|
||||
body: z.string().trim().max(10_000),
|
||||
percent: percent.nullable(),
|
||||
backgroundColor: hexColor.nullable().default(null),
|
||||
highlights: z.array(z.strictObject({
|
||||
@@ -146,7 +147,11 @@ const extraRowSchema = z.strictObject({
|
||||
(highlights) => new Set(highlights.map((highlight) => highlight.text)).size === highlights.length,
|
||||
"คำหรือวลีที่ไฮไลต์ต้องไม่ซ้ำกัน",
|
||||
).default([]),
|
||||
});
|
||||
}).transform((row) => ({
|
||||
...row,
|
||||
body: normalizeExtraRichText(row.body, row.highlights),
|
||||
highlights: [],
|
||||
}));
|
||||
|
||||
export const extraSectionSchema = z.strictObject({
|
||||
expectedVersion: z.number().int().positive(),
|
||||
|
||||
Reference in New Issue
Block a user