57 lines
1.4 KiB
Markdown
57 lines
1.4 KiB
Markdown
|
|
# T030 — Run repository 查詢契約
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M3`
|
|||
|
|
> Est. change: `~140 lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
完成後,Scout domain repository 明確支援 owner-scoped run 狀態、分頁、結果查詢與 canonical seen 判定。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- T022
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- 讀取 / 依賴:
|
|||
|
|
- 檔案:`apps/backend/internal/module/scout/domain/repository.go`
|
|||
|
|
- 既有能力 / API:Repository、Post、Run domain
|
|||
|
|
- Spec 段落:§5.1、§8、§8.1
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/backend/internal/module/scout/domain/repository.go` | edit | 新增 run CRUD、guarded update、page query、run posts、seen identities 與 publish/cleanup 契約。 |
|
|||
|
|
| `apps/backend/internal/module/scout/domain/pagination.go` | add | 定義 clamp、page result 與穩定 query filters。 |
|
|||
|
|
|
|||
|
|
### 行為變更
|
|||
|
|
|
|||
|
|
- 所有資源方法都要求 owner UID;列表回 list、total,不接受全量後切頁。
|
|||
|
|
|
|||
|
|
### API / 契約(若有)
|
|||
|
|
|
|||
|
|
- page 預設/最大值與 Spec 一致;guarded update 明確傳 expected states。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 不實作 memory/Mongo,不加入 HTTP。
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [x] MemoryStore 與 MonStore 均實作契約方法並可編譯。
|
|||
|
|
- [ ] 指令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/backend && go test ./internal/module/scout/domain -count=1
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
驗收結果:domain 與 repository packages 編譯通過。
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
查詢 filter 不暴露 Mongo 型別,避免 usecase 綁 storage。
|