thread-master/docs/product/demand-radar/tasks/T567-accept-binds-or-create...

50 lines
1.5 KiB
Markdown
Raw Normal View History

2026-08-03 05:52:02 +00:00
# T567 — accept-binds-or-creates-contact
> Status: `done`
> Milestone: `M4`
> Kind: `feat`
> Est. change: `~150 lines`
## Goal
完成後系統應:商機 accept 時綁定或建立 Contact`stage=new_found`),同一作者多筆商機收斂在同一 Contact。
## Depends on
- T547、T565、T566
## Inputs
- Spec`../spec.md` §4.6.1、§4.6.2、§9.4CR-01、CR-02
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/logic/radar/acceptOpportunityLogic.go` | edit | 呼叫 CRM usecase回應加 `contact_id` |
| `apps/backend/internal/module/crm/usecase/intake.go` | add | 依platformhandleownerFindOrCreate、AttachOpportunity、寫 `stage` touch |
| `apps/backend/internal/module/radar/repository/opportunity_mongo.go` | edit | 回寫 `contact_id` |
### 行為變更
- 已 accept 過的商機重複 accept 為 idempotent回同一 `contact_id`,不重複建 touch
- 新建 Contact 寫一筆 `stage` touch`from_stage` 空 → `new_found`)。
- 第二筆商機 accept掛上同一 Contact時間軸出現兩筆。
## Out of scope
- 階段推進 APIT568T570
- 前端T574
## Acceptance
- [x] CR-01accept → Contact 建立、`stage=new_found`
- [x] CR-02同作者第二筆 → 同一 Contact、時間軸兩筆
- [x] 指令:
```bash
cd apps/backend && go test ./internal/logic/radar/... ./internal/module/crm/... -count=1
```