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:
parent
00ac88accf
commit
651044f289
@ -162,7 +162,7 @@ const parsedEventSchema = z.object({
|
|||||||
content: z.string().optional(), // 详细内容(仅提醒)
|
content: z.string().optional(), // 详细内容(仅提醒)
|
||||||
is_holiday: z.boolean().optional(), // 节假日(仅纪念日)
|
is_holiday: z.boolean().optional(), // 节假日(仅纪念日)
|
||||||
priority: z.enum(['none', 'red', 'green', 'yellow']).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
|
// All routes require authentication
|
||||||
|
|||||||
@ -52,7 +52,7 @@ const createEventSchema = z.object({
|
|||||||
is_holiday: z.boolean().default(false),
|
is_holiday: z.boolean().default(false),
|
||||||
is_completed: z.boolean().default(false),
|
is_completed: z.boolean().default(false),
|
||||||
priority: z.enum(['none', 'red', 'green', 'yellow']).default('none'),
|
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();
|
const updateEventSchema = createEventSchema.partial();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user