@@ -1,32 +1,15 @@
|
||||
# 模块边界与所有权
|
||||
|
||||
后端保持模块化单体、统一 PostgreSQL、独立 API/Worker。目录是团队所有权边界,跨模块调用必须经过 `Tiku.Application` 合同。
|
||||
后端是共享 PostgreSQL 的模块化单体,API 与 Worker 是独立运行时。跨模块调用通过 `Tiku.Application` 契约,模块实现由 `Tiku.Infrastructure/Modules` 统一注册。
|
||||
|
||||
## 依赖方向
|
||||
|
||||
```text
|
||||
Platform Core: Tenancy / Auth / Security
|
||||
Catalog -> QuestionBanks -> Content / Assets -> Learning
|
||||
Commerce -> Points / Growth
|
||||
TenantAdmin / PlatformAdmin -> Application contracts or dedicated read models
|
||||
Jobs -> queue / processor / operations + module job handlers
|
||||
```
|
||||
|
||||
- API Controller 不得引用 `Tiku.Infrastructure` 或 `TikuDbContext`。
|
||||
- 一个模块不得引用另一个模块的 Infrastructure 类型。
|
||||
- 跨模块查询使用 Application 查询合同;跨模块写入调用目标模块命令合同。
|
||||
- `TikuDbContext` 仍是统一事务入口,但 DbSet 按模块拆在 `Persistence/Modules`。
|
||||
- EF Migration 与模型快照串行合并,由 CODEOWNERS 默认负责人复核。
|
||||
|
||||
## 子模块目录
|
||||
|
||||
- TenantAdmin:Dashboard、Classes、Students、Supervision、StudentEngagement、MembersAndAccess、SiteSettings、DomainsAndEngagement。
|
||||
- Content:Questions、Vocabulary、Handbook、EducationCatalog、Scorelines、Videos、OperationContent、Imports。
|
||||
- Learning:Analytics、Answering、QuestionReview、WordLearning、PracticeSessions、Foundation。
|
||||
- Commerce:Orders、Payments、Coupons、Refunds、Reconciliation、Adjustments、Points。
|
||||
- PlatformAdmin:Dashboard、TenantProvisioning、TenantDomains、StaffAndAccess、AuditAndAlerts、Dunning、Operations。
|
||||
|
||||
Service 文件超过 500 行应在评审中说明原因,超过 800 行由架构测试阻止新增。现有聚合接口应逐步由子模块接口替代,不允许把新能力继续追加到聚合 Service。
|
||||
- 业务模块通过 Application 查询/命令契约协作,不直接依赖其他模块的 Infrastructure 类型。
|
||||
- `TikuDbContext` 是统一事务入口;DbSet 按领域拆到 `Persistence/Modules`,Migration 和模型快照仍全局唯一。
|
||||
- `AddInfrastructure` 组合 Platform Core、Auth、Content、Learning、Tenant Admin、Commerce、Jobs 和 Platform 模块。
|
||||
- 后台任务处理器实现 `IBackgroundJobHandler`,在所属模块注册;Jobs 模块只负责队列、租约、调度和处理器查找。
|
||||
- 新 Service 聚合超过 800 行会被 `ArchitectureBoundaryTests` 阻止;既有超限服务不得超过记录的债务基线。
|
||||
|
||||
## API audience
|
||||
|
||||
@@ -37,4 +20,4 @@ Service 文件超过 500 行应在评审中说明原因,超过 800 行由架
|
||||
- `/api/system/*`:健康与内部诊断。
|
||||
- `/api/integrations/*`:外部系统回调。
|
||||
|
||||
旧的 platform-admin、backoffice、tenant-admin、tenant-content 和 tenant-commerce 路由不再提供兼容入口。后端、OpenAPI 客户端和两个前端必须作为一个发布单元回滚或上线。
|
||||
旧 audience 路由不提供兼容入口。路由变化必须同步更新 OpenAPI 客户端和对应前端。
|
||||
|
||||
Reference in New Issue
Block a user