M0-14A User & Account 模块架构设计 #14
Closed
opened 2026-05-22 21:00:16 +08:00 by wangdl
·
3 comments
Labels
Clear labels
area:activity
活动/统计
area:admin
管理后台
area:admin-api
area:ai
AI/RAG
area:ai-runtime
AI Runtime / AI 分析体系相关
area:analytics
area:api
API 接口
area:auth
认证与授权
area:cos
对象存储
area:database
数据库/Migration
area:import
文件导入/解析
area:knowledge
知识库/知识点
area:learning-info
area:learning-session
area:quiz
测验/自测
area:reading-event
area:reading-progress
area:review
复习系统
area:security
安全相关
audit:api-admin-info
audit:api-info
audit:planned
已完成宏观规划,尚未代码审查
audit:reviewed
blocked-by:api-info-aggregation
blocked-by:api-info-core
blocked-by:api-info-ops
blocked-by:api-info-schema
blocked-by:processor
blocked-by:schema
priority:p0
最高优先级,阻塞发布
priority:p1
高优先级,里程碑必需
priority:p2
中优先级,后续版本
repo:api
API 仓库 Issue
status:blocked
被阻塞
status:done
已完成
status:partial
status:todo
type:aggregation
type:bug
缺陷修复
type:design
设计
type:docs
文档
type:feature
新功能
type:migration
type:refactor
重构
type:test
work:admin-api
work:aggregation
work:api
work:artifact
题目/卡片产物
work:audit
work:circuit-breaker
熔断
work:contract
work:design
架构/协议设计工作
work:docs
work:export
work:extend-existing
work:internal-api
Runtime 内部接口
work:job
Job 调度相关
work:new-module
work:new-table
work:ops
work:query
work:quota
额度/限流
work:schema
Prisma Schema 设计
work:security
work:service
Service 层实现
work:snapshot
Snapshot 构建
work:test
No Label
Milestone
No items
No Milestone
M0:后端基础能力与架构规范闭环(P0)
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wangdl/api-server#14
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
目标
设计知习 C 端用户的注册、登录、账号基础能力,为所有 C 端业务模块(知识库、学习、复习、额度等)提供统一的用户身份底座。
本 Issue 只做模块架构设计,不直接实现代码。需先输出完整设计方案,经审核确认后,再进入后续实现 Issue。
背景说明
知习面向 iOS 和 Web 用户,首选 Apple 登录作为主要登录方式。C 端用户体系需要与 Admin 管理员体系完全隔离——两者的登录入口、token、数据表都是两套独立系统。
User & Account Module 是 M0 基础能力闭环的最后一块拼图。做完这个模块后,后续所有 C 端业务模块才能有统一的身份校验基础。
模块职责
请设计 User & Account Module 的完整职责边界。
本模块负责:
/api/*路由使用本模块不负责:
与其他模块的边界:
候选数据对象
以下对象为候选设计,请根据模块职责判断最终保留哪些、是否需要拆分或合并。
请输出:
存储与基础设施依赖
请逐项判断本模块是否需要以下基础设施,并说明理由:
API 设计
请设计本模块的 API 路由。
CAPI
/api/*候选接口(请根据设计判断最终清单和路径):
AAPI
/admin-api/*候选接口:
Admin 使用独立的 Admin token 体系,不能复用 C 端用户的 AccessToken。
IAPI
/internal/*是否需要内部接口?如果需要,请设计:
Service 划分
请设计本模块的服务分层。建议按以下维度拆分:
要求:
安全设计
请重点设计以下安全问题:
Apple 登录流程:
RefreshToken 安全:
AccessToken:
设备管理:
注销流程:
用户状态枚举:
Domain Event 设计
请设计本模块需要发布的 Domain Event。
候选事件:
请说明:
Admin 视图设计
请设计 Admin 中的 C 端用户管理视图。
用户列表页:
用户详情页:
操作审计:
交付检查
验收标准
本 Issue 完成后,交付一份 User & Account Module 架构设计文档。文档必须包含:
审核通过前,禁止直接实现代码。
禁止事项
/admin-api/*/api/*的 C 端接口(Admin 查看 C 端数据走 Admin 专属接口)M0-14 User & Account 基础身份能力to M0-14A User & Account 模块架构设计现有代码实施状态
大部分已实现:
缺失项
✅ E2E 测试通过
M0 E2E 测试已全部通过 — 28/28 tests passed,耗时 ~1.4s。
本 Issue 测试内容
GET /api/users/me → 401 without token
运行方式
测试架构
@prisma/client/ioredis/jose/@nestjs/bullmqtest/m0.e2e-spec.tswangdl referenced this issue2026-06-05 19:34:43 +08:00
wangdl referenced this issue2026-06-05 19:36:07 +08:00
关闭
架构设计阶段已完成。具体实现已通过后续 M1-M7 milestone 的 issue 交付。本 issue 作为设计文档保留。