feat: add AIEvent validation schemas

This commit is contained in:
2026-01-27 21:33:29 +08:00
parent 76c45c7132
commit 65b84e641d
+22
View File
@@ -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<typeof KeywordInputSchema>
export type BatchKeywordsRequest = z.infer<typeof BatchKeywordsRequestSchema>
export type Quarter = z.infer<typeof QuarterSchema>
export type VisualStyleRule = z.infer<typeof VisualStyleRuleSchema>
export type AIEventInput = z.infer<typeof AIEventInputSchema>
export type AIEventQuery = z.infer<typeof AIEventQuerySchema>
export type KeywordCloudResponse = z.infer<typeof KeywordCloudResponseSchema>