thread-master/docs/product/demand-radar/tasks/T572-conversion-report-writ...

51 lines
1.7 KiB
Markdown
Raw Normal View History

2026-08-03 05:52:02 +00:00
# T572 — conversion-report-writes-growth-outcomes
> Status: `done`
> Milestone: `M4`
> Kind: `feat`
> Est. change: `~180 lines`
## Goal
完成後系統應:成交回報把階段轉 `won` 並寫入**既有** `growth_outcomes``source_type=radar_opportunity`),成果彙總含這筆。
## Depends on
- T568
## Inputs
- Spec`../spec.md` §4.6.6、§6、§9.4CR-08、§9.6RG-03
- 既有:`apps/backend/internal/module/growth/**`OutcomeEventAttributionLink、`internal/logic/outcomes/**`
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/generate/api/crm.api` | edit | conversion POST reqresp |
| `apps/backend/internal/logic/crm/createContactConversionLogic.go` | edit | 驗證 → 轉 `won` → 寫 OutcomeEvent → 寫 `conversion` touch |
| `apps/backend/internal/module/growth/domain/**` | edit | 新增 `source_type=radar_opportunity` 常數與 `opportunity_id``contact_id` 關聯欄位 |
### 行為變更
- **系統永不自動判定成交**:只有此端點(人為操作)能寫成交。
- 金額選填P0 以筆數為主),幣別預設 TWD負數或非法幣別回明確錯誤。
- 不新增成交 collection既有成果頁與彙總同時看到 radar 成交RG-03
## Out of scope
-刪成交T573
- 金額維度統計P1
## Acceptance
- [x] CR-08回報 12000 → 階段 `won`、`growth_outcomes` 有一筆 `source_type=radar_opportunity`、成果頁可見
- [x] RG-03既有歸因與成果卡行為不變
- [x] 指令:
```bash
cd apps/backend && go test ./internal/logic/crm/... ./internal/module/growth/... -count=1
```