fix: 修复 Zod repeat_interval 验证错误
将 repeat_interval schema 从 .positive() 改为 .min(1).optional().nullable() 解决传入 null 时验证失败的问题 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dd21c03e06
commit
c36a56e0a4
@ -47,7 +47,7 @@ const createEventSchema = z.object({
|
||||
date: z.string().optional(), // Can be empty string for reminders
|
||||
is_lunar: z.boolean().default(false),
|
||||
repeat_type: z.enum(['daily', 'weekly', 'monthly', 'yearly', 'none']).default('none'),
|
||||
repeat_interval: z.number().int().positive().optional().nullable(), // 自定义间隔(周数)
|
||||
repeat_interval: z.number().int().min(1).optional().nullable(), // 自定义间隔(周数)
|
||||
next_reminder_date: z.string().optional().nullable(), // 下一次提醒日期
|
||||
is_holiday: z.boolean().default(false),
|
||||
is_completed: z.boolean().default(false),
|
||||
@ -189,6 +189,7 @@ router.put(
|
||||
}
|
||||
|
||||
const data = updateEventSchema.parse(req.body);
|
||||
console.log('[Update Event] Request body:', JSON.stringify(req.body));
|
||||
|
||||
// Build dynamic update query
|
||||
const updates: string[] = [];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user