thread-master/docs/product/demand-radar/tasks/T587-followup-api-list-done...

52 lines
1.6 KiB
Markdown
Raw Normal View History

2026-08-03 05:52:02 +00:00
# T587 — followup-api-list-done-snooze-escalate
> Status: `done`
> Milestone: `M5`
> Kind: `feat`
> Est. change: `~170 lines`
## Goal
完成後系統應:待追蹤清單、完成、延後三個端點可用;通知達 2 次轉 `escalated` 只**建議**轉 `lost`
## Depends on
- T586
## Inputs
- Spec`../spec.md` §3.5、§4.7.4、§4.7.5、§5.2、§9.4FU-03、FU-04
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/generate/api/crm.api` | edit | followups listdonesnooze type |
| `apps/backend/internal/logic/crm/listFollowupsLogic.go` | edit | 分頁清單(狀態、到期時間排序) |
| `apps/backend/internal/logic/crm/doneFollowupLogic.go` | edit | 轉 `done` |
| `apps/backend/internal/logic/crm/snoozeFollowupLogic.go` | edit | 延後 N 天 → `scheduled` |
| `apps/backend/internal/module/crm/usecase/followup_scan.go` | edit | `notified_count >= 2``escalated` |
### 行為變更
- `escalated` **不自動改階段、不自動關閉**,只在回應與 CRM 顯示「建議轉未成交」。
- snooze 天數需為正整數,非法回明確錯誤。
- 清單回 `pagination` + `list`,含所屬 Contact 摘要。
## Out of scope
- AI 追蹤訊息T588
- 前端收件匣T591
## Acceptance
- [x] FU-03通知 2 次後 `escalated` 且階段未變
- [x] FU-04snooze 5 天 → `due_at` 後移且狀態回 `scheduled`
- [x] 指令:
```bash
cd apps/backend && make gen-api && go test ./internal/logic/crm/... ./internal/module/crm/... -count=1
```