thread-master/docs/product/haixun-console/tasks/T007-repo-interfaces.md

49 lines
1.1 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.

# T007 — Domain types + repo interfaces + createRepos
> Status: `todo`
> Milestone: `M3`
> Est. change: `~180 lines`
## Goal
TypeScript domain 型別 + repository 介面;`createRepos('mock'|'live')` 工廠就位live 可 throw/not implemented
## Depends on
- T006
## Inputs
- Spec §2 實體、§5.1 JSON 形狀、§5.0 共用規則
## Outputs
### 程式變更
| 路徑 | 動作 | 說明 |
|------|------|------|
| `apps/web/src/domain/types.ts` | add | Member, ThreadsAccount, ThreadPlay, PlayStep, Outbox*, Job, Notification |
| `apps/web/src/data/repos.ts` | add | interface 定義 |
| `apps/web/src/data/createRepos.ts` | add | 工廠 |
| `apps/web/src/data/DataContext.tsx` | add | 提供 repos 給 React |
### 行為變更
- 型別含 `lead_account_id`, `cast_account_ids`, steps with kind root|reply
- Speakers 校驗 helper 可放 `domain/speakers.ts`
## Out of scope
- mock 實作細節T008
- HTTP client live
## Acceptance
- [ ] 型別可 compile
- [ ] `createRepos('mock')` 可呼叫(實作可先空再由 T008 補)
- [ ] `npm run build` 通過
```bash
cd apps/web && npm run build
```