fix: 修复 reminder_times 为 null 导致的 500 错误

- Zod schema 允许 reminder_times 为 null
- events.ts 和 ai.ts 中的 schema 都添加 .nullable()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ddshi 2026-03-02 17:37:49 +08:00
parent 00ac88accf
commit 651044f289
2 changed files with 2 additions and 2 deletions

View File

@ -162,7 +162,7 @@ const parsedEventSchema = z.object({
content: z.string().optional(), // 详细内容(仅提醒)
is_holiday: z.boolean().optional(), // 节假日(仅纪念日)
priority: z.enum(['none', 'red', 'green', 'yellow']).optional(), // 颜色(仅提醒)
reminder_times: z.array(z.string()).optional(), // 提前提醒时间点
reminder_times: z.array(z.string()).optional().nullable(), // 提前提醒时间点
});
// All routes require authentication

View File

@ -52,7 +52,7 @@ const createEventSchema = z.object({
is_holiday: z.boolean().default(false),
is_completed: z.boolean().default(false),
priority: z.enum(['none', 'red', 'green', 'yellow']).default('none'),
reminder_times: z.array(z.string()).optional(), // 提醒时间点数组JSON
reminder_times: z.array(z.string()).optional().nullable(), // 提醒时间点数组JSON
});
const updateEventSchema = createEventSchema.partial();