From 65b84e641df25f442fa40419242f8c2604b13fb7 Mon Sep 17 00:00:00 2001 From: mzaxd Date: Tue, 27 Jan 2026 21:33:29 +0800 Subject: [PATCH] feat: add AIEvent validation schemas --- src/lib/validations.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib/validations.ts b/src/lib/validations.ts index bdf4707..b8f9a90 100644 --- a/src/lib/validations.ts +++ b/src/lib/validations.ts @@ -203,6 +203,26 @@ export const KeywordCloudResponseSchema = z.object({ error: z.string().optional(), }) +// ================================ +// AI Timeline Schemas +// ================================ + +export const AIEventInputSchema = z.object({ + title: z.string().min(1).max(200), + titleEn: z.string().max(200).optional(), + eventDate: z.string().datetime(), + description: z.string().min(10).max(500), + descriptionEn: z.string().max(500).optional(), + imageUrl: z.string().url(), + sourceUrl: z.string().url().optional(), +}) + +export const AIEventQuerySchema = z.object({ + year: z.string().regex(/^\d{4}$/).optional(), + limit: z.string().regex(/^\d+$/).transform(Number).optional(), + offset: z.string().regex(/^\d+$/).transform(Number).optional(), +}) + // ================================ // Types // ================================ @@ -211,4 +231,6 @@ export type KeywordInput = z.infer export type BatchKeywordsRequest = z.infer export type Quarter = z.infer export type VisualStyleRule = z.infer +export type AIEventInput = z.infer +export type AIEventQuery = z.infer export type KeywordCloudResponse = z.infer