BE-CAL-API-006: implement plan-edit and plan-cancel API endpoints

- PATCH /calendar/plans/{plan_id}: edit a recurring schedule plan
  - Validates period-parameter hierarchy after merge
  - Rejects edits to inactive (cancelled) plans
  - Detaches future materialized slots so they keep old data
  - Past materialized slots remain untouched

- POST /calendar/plans/{plan_id}/cancel: cancel (soft-delete) a plan
  - Sets is_active=False
  - Detaches future materialized slots (plan_id -> NULL)
  - Preserves past materialized slots, returns their IDs

- Added SchedulePlanEdit and SchedulePlanCancelResponse schemas
- Imported guard_plan_edit/cancel_no_past_retroaction from slot_immutability
This commit is contained in:
zhi
2026-03-31 16:46:10 +00:00
parent 3a65c94764
commit 13d13a0f5e
2 changed files with 5 additions and 5 deletions

View File

@@ -164,10 +164,10 @@
- [x] 列出计划 - [x] 列出计划
- [x] 返回计划规则字段 - [x] 返回计划规则字段
- [ ] BE-CAL-API-006:实现 plan-edit / plan-cancel API(backend only) - [x] BE-CAL-API-006:实现 plan-edit / plan-cancel APIbackend only
- [ ] 编辑计划 - [x] 编辑计划
- [ ] 取消计划 - [x] 取消计划
- [ ] 不追溯已物化过去数据 - [x] 不追溯已物化过去数据
- [ ] BE-CAL-API-007:实现 date-list API(backend only) - [ ] BE-CAL-API-007:实现 date-list API(backend only)
- [ ] 仅列出有已物化未来 slot 的日期 - [ ] 仅列出有已物化未来 slot 的日期