58 lines
1.6 KiB
Markdown
58 lines
1.6 KiB
Markdown
|
|
# T840 — demand map domain repository
|
|||
|
|
|
|||
|
|
> Status: `done`(2026-08-11)
|
|||
|
|
> Milestone: `M4`
|
|||
|
|
> Est. change: `~190 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
完成後每個產品有可追溯的 current DemandMap,包含五類 phrase、basis、origin、狀態與 input/map version。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T823(Phase B UX approval)
|
|||
|
|
- T830、T833
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- `apps/backend/internal/module/radar/domain/`
|
|||
|
|
- Brand/Product repository 既有真相讀取介面
|
|||
|
|
- Spec §4.1、§10、驗收 #6、#22
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/radar/domain/demand_map.go` | add | map、phrase、version、state domain |
|
|||
|
|
| `apps/backend/internal/module/radar/repository/demand_map_memory.go` | add | memory current/history/conflict |
|
|||
|
|
| `apps/backend/internal/module/radar/repository/demand_map_mongo.go` | add | Mongo persistence/owner query |
|
|||
|
|
| `apps/backend/internal/module/radar/domain/demand_map_test.go` | add | invariant tests |
|
|||
|
|
|
|||
|
|
### 行為變更
|
|||
|
|
|
|||
|
|
- user phrase、AI phrase、product basis 可區分;版本衝突拒絕覆寫。
|
|||
|
|
|
|||
|
|
### API / 契約(若有)
|
|||
|
|
|
|||
|
|
- 產品 owner/brand relation 必須由 backend 重查。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 不做 baseline builder、AI enrichment、CostPreview endpoint。
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] ready/incomplete/stale、五類 phrase、enabled、version invariant 通過。
|
|||
|
|
- [x] memory/Mongo owner isolation parity 通過。
|
|||
|
|
- [ ] 指令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/radar/... -run 'DemandMap' -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
DemandMap 是可追溯搜尋上下文,不取代 Brand/Product 真相。
|