refactor(architecture): harden module boundaries
Some checks failed
ci / release-gate (push) Has been cancelled
Some checks failed
ci / release-gate (push) Has been cancelled
This commit is contained in:
27
docs/architecture/module-data-ownership.md
Normal file
27
docs/architecture/module-data-ownership.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# 模块数据所有权
|
||||
|
||||
本仓库保留一个物理 `TikuDbContext`、一个 EF Model、一个 Migration Snapshot 和一个请求级工作单元。
|
||||
业务实现不得直接依赖具体 Context,而应依赖下表中的持久化能力。所有能力在同一作用域内解析到同一个
|
||||
`TikuDbContext`,因此租户过滤、SaveChanges 拦截器、ChangeTracker 和本地事务语义保持一致。
|
||||
|
||||
| 能力 | 所有者 | 数据范围 |
|
||||
| --- | --- | --- |
|
||||
| `IIdentityPersistence` | Identity/Auth | 用户、身份、成员关系、认证会话、短信验证 |
|
||||
| `ITenancyPersistence` | Tenancy | 租户、域名、品牌、运行时配置、外部身份源和租户密钥 |
|
||||
| `ITenantAdministrationPersistence` | TenantAdmin | 班级、学生档案、跟进、主题、徽章和租户账务策略 |
|
||||
| `ICatalogPersistence` | Catalog | 地区、院校、专业、科目、分类、Taxonomy 和分数线 |
|
||||
| `IQuestionBankPersistence` | QuestionBank | 题库、题目版本、内容节点、集合、组卷蓝图和导入 |
|
||||
| `IContentAssetPersistence` | Content/Assets | 词汇、手册、文件、图片、视频和访问/扫描事件 |
|
||||
| `ILearningPersistence` | Learning | 练习、答题、错题、收藏、报告、学习积分流水 |
|
||||
| `ICommercePersistence` | Commerce | 商品、订单、支付、权益、优惠券、退款、对账和调账 |
|
||||
| `IPointsPersistence` | Points | 积分任务、领取和兑换 |
|
||||
| `IGrowthPersistence` | Growth | 推荐、CRM 和佣金结算 |
|
||||
| `IJobsOperationsPersistence` | Platform Core/Jobs | 权限、审计、后台任务、通知和授权缓存失效 |
|
||||
| `IPlatformControlPlanePersistence` | Platform | SaaS 商品目录、订阅、平台账单、治理和导入控制面 |
|
||||
|
||||
跨模块读取优先调用数据所有者的 Application 查询合同;跨模块修改调用所有者命令合同,不传递
|
||||
tracked entity 或 `IQueryable`。控制面、平台题库、平台账单、Owner 激活和 Bootstrap 允许使用显式的
|
||||
组合持久化能力,但不得在普通功能模块注册或注入这些组合能力。
|
||||
|
||||
数据库结构变更仍由单一维护者串行生成和合并 Migration/Snapshot。Gitea 不使用 CODEOWNERS;团队所有权
|
||||
以本文件和模块目录为准。
|
||||
Reference in New Issue
Block a user