60 lines
1.8 KiB
Markdown
60 lines
1.8 KiB
Markdown
|
|
# T034 — Run usecase 與 API logic
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M3`
|
|||
|
|
> Est. change: `~180 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
完成後,會員可透過真 usecase 分頁列出自己的 runs/results 並刪除終態 run。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T033
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- 讀取 / 依賴:
|
|||
|
|
- 檔案:`apps/backend/internal/module/scout/usecase/service.go`、`internal/logic/scout/*run*_logic.go`
|
|||
|
|
- 既有能力 / API:Run repository、UID middleware、response.Biz、converters
|
|||
|
|
- Spec 段落:§4 流程 D–F、§5.1
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/scout/usecase/runs.go` | add | 實作 ListRuns、ListRunPosts、RemoveRun 與 page clamp。 |
|
|||
|
|
| `apps/backend/internal/logic/scout/list_scout_runs_logic.go` | edit | 以真 usecase 取代 T022 的 503。 |
|
|||
|
|
| `apps/backend/internal/logic/scout/list_scout_run_posts_logic.go` | edit | 回 run+list+pagination。 |
|
|||
|
|
| `apps/backend/internal/logic/scout/remove_scout_run_logic.go` | edit | 終態刪除,running 回 409。 |
|
|||
|
|
| `apps/backend/internal/logic/scout/run_logic_test.go` | add | 覆蓋 auth、owner、pagination 與 conflict。 |
|
|||
|
|
|
|||
|
|
### 行為變更
|
|||
|
|
|
|||
|
|
- 非 owner 資源對外視為 404;不得洩漏是否存在。
|
|||
|
|
|
|||
|
|
### API / 契約(若有)
|
|||
|
|
|
|||
|
|
- 成功 envelope 由既有 gateway 統一包裝,data 不包含 owner UID。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 不建立 run、不執行搜尋或 job。
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] 新端點不再有成功空資料或暫時 503。
|
|||
|
|
- [x] 指令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/scout/... ./internal/logic/scout/... -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
驗收結果:Run usecase 與三個 API logic 已接上 owner-scoped repository;列表、結果分頁、終態刪除及授權/跨 owner/衝突測試通過。
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
刪除 run 不刪 homework;單 post 刪除後更新 run counts。
|