Files
digital-psychology/.ai/product/feature-spec/profile.md
T
jackyu66gitandCursor bd22d9dddd feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:37:53 +08:00

166 lines
3.6 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.
# Feature Spec: 个人档案
> Status: `Active` · Map: `1.1 创建个人档案 · 5.1 我的档案 [P1]` · Phase: `P1`
> 规范:[../feature-design.md](../feature-design.md)
---
## 1. 功能定义
| 字段 | 内容 |
|---|---|
| Name | 个人档案 |
| Purpose | 建立「我」与「TA」的结构化档案,作为画像、关系、问答的输入 |
| Business Goal | 漏斗 Step 1;提高后续功能完成率 |
| In | Out |
|---|---|
| Self / Other;生日必填;编辑删除 | 完整户籍式资料收集 |
| 关系类型(伴侣/家人/朋友) | 强制出生时辰地点(可后置) |
---
## 2. 用户价值
1. **为何需要:** 个性化分析需要稳定身份锚点。
2. **完成后获得:** 可切换的 Self/Other 列表;后续功能可挂档案。
3. **付费:** N/A(档案本身免费)。
---
## 3. 用户角色
| Actor | 能力 |
|---|---|
| Visitor | CRUD 自己的 profiles |
| 他人档案 | 不可读写 |
---
## 4. 用户流程
```text
首页快捷建档(生日) 或 /profile
创建 Selfdisplay_name + birth_date
可选:添加 TArelation=other
编辑 / 删除
下游:画像 / 关系 / 问答选择档案
```
---
## 5. 页面设计
| 路由 | 页面 |
|---|---|
| `/` | 首页内嵌建档入口 |
| `/profile` | ProfilePage(列表/编辑/删除/加 TA |
| `/mine` | 入口到档案 |
```text
/profile
├── Loading
├── Empty(无档案 → 引导创建)
├── Normal(列表 + 编辑)
└── Error
```
---
## 6. 页面状态规范
| 状态 | UI |
|---|---|
| Loading | 拉取列表 |
| Empty | CTA 创建「我」 |
| Error | 重试 |
| Normal | Self/Other 卡片;编辑表单;删除确认 |
---
## 7. Business Rules
| ID | Rule |
|---|---|
| R1 | `birth_date` P1 必填 |
| R2 | `relation` = `self` \| `other`other 建议 `relation_type` |
| R3 | 仅所有者可 PATCH/DELETE |
| R4 | 删除策略:任务未要求硬删 PII 时按实现(软删优先);级联影响报告见服务规则 |
| R5 | Ask / 画像 / 关系必须挂合法 profile_id |
| R6 | 文案用「个人档案」,不用命盘 |
---
## 8. 数据模型影响
| 表 | 字段要点 |
|---|---|
| `profiles` | id, user_id, relation, display_name, birth_date, birth_time?, birth_place?, gender?, relation_type? |
---
## 9. API 需求
| Method | Path | 意图 |
|---|---|---|
| GET | `/api/v1/profiles` | 列表 |
| POST | `/api/v1/profiles` | 创建 |
| PATCH | `/api/v1/profiles/{id}` | 更新 |
| DELETE | `/api/v1/profiles/{id}` | 删除 |
---
## 10. 权限设计
| 能力 | Visitor(己方) | 他方 |
|---|---|---|
| 列表/创建/改/删 | ✓ | ✗ |
---
## 11. 埋点
| Event | 触发 |
|---|---|
| `profile_create_started` | 开始创建 |
| `profile_created` | Self 或 Other 创建成功 |
| `profile_updated` | 保存编辑 |
| `profile_deleted` | 删除成功 |
---
## 12. 测试验收标准
**Given** 无档案
**When** 创建 Self 合法生日
**Then** 列表出现;可被画像使用
**Given** 已有 Self
**When** 添加 TA
**Then** relation=other 且可用于关系理解
**Given** 他人 id
**When** PATCH
**Then** 失败
---
## 13. AI 开发前检查
- [x] Spec 齐全 · map · lexicon · OpenAPI · 可测
---
## 14. Implementation Notes
| 项 | 内容 |
|---|---|
| Packages | `service/profile` · `ProfilePage` · 首页建档 |
| Gaps | birth_time/place UI 可后置;硬删 vs 软删统一;埋点未接 |
| Tests | Profile 更新/删除 API L2ProfilePage 四态 |
| Process Review | 2026-08-02 [P1-PROCESS-REVIEW](P1-PROCESS-REVIEW.md) · 设计闭合 · 实现 PASS · 测试 PARTIAL |