feat : update
This commit is contained in:
+15
-6
@@ -131,16 +131,25 @@ export const teamSectionSchema = z.strictObject({
|
||||
})).max(30),
|
||||
});
|
||||
|
||||
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),
|
||||
percent: percent.nullable(),
|
||||
backgroundColor: hexColor.nullable().default(null),
|
||||
textColor: hexColor.nullable().default(null),
|
||||
}).refine(
|
||||
(row) => (row.backgroundColor === null) === (row.textColor === null),
|
||||
{ message: "ต้องเลือกสีพื้นหลังและสีข้อความพร้อมกัน", path: ["backgroundColor"] },
|
||||
);
|
||||
|
||||
export const extraSectionSchema = z.strictObject({
|
||||
expectedVersion: z.number().int().positive(),
|
||||
sections: z.array(z.strictObject({
|
||||
title: z.string().trim().min(1).max(160),
|
||||
rows: z.array(z.strictObject({
|
||||
mediaId: z.string().uuid().nullable(),
|
||||
heading: z.string().trim().min(1).max(200),
|
||||
body: z.string().trim().max(2_000),
|
||||
percent: percent.nullable(),
|
||||
})).max(50),
|
||||
rows: z.array(extraRowSchema).max(50),
|
||||
})).max(20),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user