51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
|
|
# 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.4(CR-08)、§9.6(RG-03)
|
|||
|
|
- 既有:`apps/backend/internal/module/growth/**`(OutcomeEvent/AttributionLink)、`internal/logic/outcomes/**`
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/generate/api/crm.api` | edit | conversion POST req/resp |
|
|||
|
|
| `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
|
|||
|
|
```
|