thread-master/docs/product/scout-topic-quality/tasks/T022-run-api-converters-gua...

60 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# T022 — API converters 與未實作保護
> Status: `done`
> Milestone: `M2`
> Est. change: `~160 lines`
## Goal
完成後Run domain 能完整轉成公開型別,並以 JWT、輸入驗證及測試固定 T020 的未實作保護。
## Depends on
- T021
## Inputs
- 讀取 / 依賴:
- 檔案:`apps/backend/internal/types/m5_convert.go`、`apps/backend/internal/logic/scout/*run*_logic.go`
- 既有能力 / APIresponse.Biz、middleware.UIDFrom、Pagination
- Spec 段落§5.1、§7
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/internal/types/m5_convert.go` | edit | 新增 RunRunIDpagination converters。 |
| `apps/backend/internal/logic/scout/list_scout_runs_logic.go` | edit | 加入 JWT 與 page/filter 驗證,保留明確 503 待 T034 替換。 |
| `apps/backend/internal/logic/scout/list_scout_run_posts_logic.go` | edit | 加入 JWT、run ID 與 page 驗證,保留明確 503。 |
| `apps/backend/internal/logic/scout/remove_scout_run_logic.go` | edit | 加入 JWT 與 run ID 驗證,保留明確 503。 |
| `apps/backend/internal/types/m5_convert_test.go` | add/edit | 驗證公開欄位與 unix ns 原樣傳遞。 |
### 行為變更
- 未接 persistence 的新端點回 503xxx舊端點不受影響。
### API / 契約(若有)
- 不回 owner_uid、provider token、payload 或內部錯誤堆疊。
## Out of scope
- 不實作實際列表、刪除或 job 建立。
## Acceptance
- [x] converter 覆蓋所有 run counters 與 shortfall reasons。
- [ ] 指令:
```bash
cd apps/backend && go test ./internal/types ./internal/logic/scout/... -count=1
```
驗收結果types 與 Scout logic 測試通過。
## Notes
T034 必須移除暫時 503 並用真 usecase 結果取代。