feat: add AIEvent validation schemas
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user