24 lines
834 B
Markdown
24 lines
834 B
Markdown
|
|
# 2026-06-08 调度单次执行保存 500 修复
|
|||
|
|
|
|||
|
|
## 摘要
|
|||
|
|
|
|||
|
|
修复新建「文件推送 + 单次执行」调度保存失败(HTTP 500):`fire_at` ISO 字符串未转为 `datetime` 写入 ORM。
|
|||
|
|
|
|||
|
|
## 动机
|
|||
|
|
|
|||
|
|
默认 `run_mode=once`;前端提交 `fire_at` 为 `toISOString()` 字符串,SQLAlchemy DateTime 列拒绝字符串导致插入失败。循环模式 `fire_at=null` 不受影响。
|
|||
|
|
|
|||
|
|
## 变更
|
|||
|
|
|
|||
|
|
- `server/api/schema_path_validators.py`:新增 `coerce_optional_iso_datetime`
|
|||
|
|
- `server/api/schemas.py`:`ScheduleCreate` / `ScheduleUpdate` 的 `fire_at` 校验并解析为 `datetime`
|
|||
|
|
- `tests/integration/test_schedules.py`:补充 once 推送创建用例
|
|||
|
|
|
|||
|
|
## 验证
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
.venv/bin/pytest tests/integration/test_schedules.py -q
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
生产:`POST /api/schedules/`(`run_mode=once` + `source_path`)应返回 201。
|