Files
tupingr 6992f59cd2 refactor(arch): 信息架构升级 — 三层四角色控制面板 + 跨平台 task 交接协议
核心变化:
- dashboard.md 替代 DASHBOARD + ROADMAP,人类+Arch AI 唯一入口
- DECISIONS.md 人类决策入口,≤3 条待决策
- .ai/tasks/ 14 个独立 task 文件(Coder 8 + Tester 6),弱模型自包含可独立执行
- 旧 today/queue 归档,每个角色启动 ≤2 个文件
- ADR-012 跨平台「高模型指挥小模型」协作架构落地
- 知识库补全:L-002~005、P-004~005、ADR-011~012
- Arch AI 上下文资源管理硬约束写入 principles.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 15:17:06 +08:00

70 lines
2.0 KiB
Markdown
Raw Permalink 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.
# Task P01-003: User 模块(个人资料 CRUD + 邀请链)
## 元信息
| 字段 | 值 |
|------|-----|
| 状态 | `todo` |
| 优先级 | P1 |
| 依赖 | P01-002Auth 模块,需要 JWT AuthGuard |
| 分配给 | Coder AI (Trae CN + GLM-4.6) |
## 输入
**要读的文件**:
- `docs/02_系统架构/模块设计.md` — 3.3 User 模块
- `docs/02_系统架构/数据模型.md` — users 表 + user_relations 表
- `projects/app/src/db/schema/*.ts` — P01-001 产出的 Drizzle Schema
- `projects/app/src/modules/auth/auth.guard.ts` — P01-002 产出的 AuthGuard
**参考的 ADR**:
- 无特殊 ADR
**上游依赖产出**:
- P01-002: AuthGuard(本模块所有接口需要 JWT 验证)
## 输出
**要生成/修改的文件**:
- `projects/app/src/modules/user/user.module.ts`
- `projects/app/src/modules/user/user.controller.ts`
- `projects/app/src/modules/user/user.service.ts`
**API**:
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | /user/profile | 获取个人信息 |
| PATCH | /user/profile | 更新个人信息(昵称、头像、年级) |
| POST | /user/invite | 生成邀请码 |
| GET | /user/invite/tree | 查询邀请链(递归 CTE |
**关键逻辑**:
- 邀请码生成: 6 位字母数字随机码,唯一
- 邀请链查询: `WITH RECURSIVE` CTE 查 user_relations 表,返回被邀请人列表+层级
## 验收方法
```bash
# 编译检查
npx tsc --noEmit
# 测试邀请链查询
curl -H "Authorization: Bearer {token}" http://localhost:3000/user/invite/tree
# 预期: { tree: [{ userId, nickname, level, invitedAt }] }
```
## 约束
- 不碰: `projects/app/tests/`、其他 modules/ 目录
- 技术栈: NestJS + Drizzle ORM(嵌套查询)
- 遵循: `.ai/prompts/coding/code-style.md`
## 完成报告
> Coder 完成后填写。Commit message 以 `[READY_FOR_TEST]` 结尾。
- [ ] 输出文件已生成
- [ ] 验收命令通过
- [ ] Commit: `{hash}`
- [ ] Commit message: `feat(P01-003): User 模块(CRUD+邀请链) [READY_FOR_TEST]`