Organize/lib/validation/group.ts

16 lines
402 B
TypeScript

import { z } from "zod";
import { GROUP_COLORS } from "@/lib/colors";
const colorKeys = GROUP_COLORS.map((c) => c.key) as [string, ...string[]];
export const GroupTitleSchema = z
.string()
.trim()
.min(1, "Title is required")
.max(20, "Title must be 20 characters or fewer");
export const GroupColorSchema = z.enum(colorKeys);
export const GroupNoteContentSchema = z.string().max(50_000);