54 lines
1.8 KiB
Markdown
54 lines
1.8 KiB
Markdown
|
|
# T700 — radar product api contract goctl
|
|||
|
|
|
|||
|
|
> Status: `done`(2026-08-10)
|
|||
|
|
> Milestone: `M0` · Phase A
|
|||
|
|
> Kind: `feat` · Est. change: `~180 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
用 goctl 契約定義產品型 watch、ProductMatch、產品篩選、補綁與主推產品操作,所有新增 logic 在未實作前回明確 not-ready。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- —
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- `../spec.md` §5.1–§5.3
|
|||
|
|
- `apps/backend/generate/api/radar.api`、`m5.api`、`gateway.api`
|
|||
|
|
- 既有 `ErrNotReady` 回應語意與 AGENTS goctl 規則
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/generate/api/radar.api` | edit | 新增 context、ProductMatch、filters、assign-product、primary-product、counters |
|
|||
|
|
| `apps/backend/internal/handler/**`、`internal/types/types.go` | generated | 只由 `make gen-api` 更新 |
|
|||
|
|
| `apps/backend/internal/logic/radar/**` | edit/add | 新能力先回 not-ready,禁止空成功 |
|
|||
|
|
|
|||
|
|
## Behavior
|
|||
|
|
|
|||
|
|
- Brand/Product 欄位必須成對;時間為 unix ns;列表使用 `page/pageSize`。
|
|||
|
|
- 既有 response 欄位保持相容,`matched_service` 不移除。
|
|||
|
|
- 所有路由只接受會員 JWT;provider token 不進 request 契約。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- watch/match 業務與 Mongo 寫入(T730 起)
|
|||
|
|
- 前端型別(T702)
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] goctl 後 backend 可 build,新增能力非 102000 空資料。
|
|||
|
|
- [x] 沒有手寫 handler 或 routes。
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && make gen-api && make build && go test ./internal/logic/radar/ -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 實作結果
|
|||
|
|
|
|||
|
|
- 新增 product context/ProductMatch/產品篩選契約與 `assign-product`、`primary-product` 路由。
|
|||
|
|
- 新增 logic 目前回 `radar capability not ready`,由既有 response mapping 轉 HTTP 501/非 102000。
|
|||
|
|
- 驗證:`make gen-api`、`make build`、`go test ./... -count=1` 全部通過。
|