thread-master/docs/product/growth-loop/tasks/T301-mongo-indexes-growth-l...

51 lines
1.0 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.

# T301 — mongo-indexes-growth-loop
> Status: `done`
> Milestone: `M0`
> Kind: `feat`
> Est. change: `~120 lines`
## Goal
完成後系統應:`cmd/init`(或既有 index 包)為 OutcomeWeeklyCheckupAccountHealthWorkspaceInviteRewardDraftReview 建立可重跑 index。
## Depends on
- T300
## Inputs
- Spec`../spec.md` §8
- 既有:`apps/backend` initmongo index 模式haixun-backend T104
## Outputs
### 程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/backend/cmd/init/**``internal/**/index/**` | edit | 新集合 index |
| 相關 test | add | idempotent 可重跑 |
### 行為變更
- index 含 owner_uid、source 查詢鍵、week_key、workspace_id 等(對齊 spec §8
## Out of scope
- seeder 示範資料(可另開;非本 task 必須)
## Acceptance
- [ ] init 可重複執行不炸
- [ ] 指令:
```bash
cd apps/backend && go test ./... -count=1 -run Index|Init
# 或專案文件中的 init 指令 dry-run
```
## Notes