fengling-platform/.planning/phases/01-gateway-routing/01-gateway-routing-01-PLAN.md
movingsam 1b8c937aa4
Some checks failed
Build and Push Docker / build (push) Failing after 23s
Publish NuGet Packages / build (push) Failing after 8s
feat: 添加 Gateway 路由实体到 Platform
- 新增 GatewayAggregate 领域实体 (GwTenant, GwTenantRoute, GwServiceInstance)
- 新增 IRouteStore, RouteStore, IInstanceStore, InstanceStore
- 新增 IRouteManager, RouteManager
- 合并 GatewayDbContext 到 PlatformDbContext
- 统一 Extensions.AddPlatformCore 注册所有服务
2026-02-28 23:53:00 +08:00

132 lines
4.3 KiB
Markdown

---
phase: 01-gateway-routing
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GatewayEnums.cs
autonomous: true
requirements:
- GATEWAY-01
- GATEWAY-02
- GATEWAY-03
must_haves:
truths:
- "Gateway 实体可以在 Platform DbContext 中使用"
- "实体遵循现有 Platform 命名约定"
- "实体 ID 统一使用 long 类型"
artifacts:
- path: "Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs"
provides: "网关租户实体,包含通用属性"
min_lines: 30
- path: "Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs"
provides: "YARP 路由配置实体"
min_lines: 30
- path: "Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs"
provides: "负载均衡服务实例实体"
min_lines: 30
key_links:
- from: "GwTenantRoute"
to: "GwTenant"
via: "TenantCode 字段"
pattern: "TenantCode string"
---
# 计划 01: 网关领域实体
## 目标
创建从 fengling-gateway 项目迁移的网关路由领域实体。
**目的:** 在 Platform 领域层建立网关聚合,包含符合 YARP 要求的实体。
**输出:** 新建 GatewayAggregate 文件夹中的三个实体文件。
## 上下文
@Fengling.Platform.Domain/AggregatesModel/ (现有 Tenant 聚合结构)
@../fengling-gateway/src/Models/ (源实体)
## 任务
<task type="auto">
<name>任务 1: 创建 GatewayEnums</name>
<files>Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GatewayEnums.cs</files>
<action>
创建网关实体使用的枚举类型:
- RouteStatus (Active=1, Inactive=0)
- InstanceHealth (Healthy=1, Unhealthy=0)
- InstanceStatus (Active=1, Inactive=0)
参考现有: Fengling.Platform.Domain/AggregatesModel/TenantAggregate/Tenant.cs
</action>
<verify>文件可编译,枚举可访问</verify>
<done>GatewayEnums.cs 已创建,包含 RouteStatus, InstanceHealth, InstanceStatus</done>
</task>
<task type="auto">
<name>任务 2: 创建 GwTenant 实体</name>
<files>Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs</files>
<action>
创建 GwTenant 实体,包含:
- Id (long), TenantCode (string), TenantName (string)
- Status (int), IsDeleted (bool), Version (int)
- CreatedTime, UpdatedTime, CreatedBy, UpdatedBy
参考源: ../fengling-gateway/src/Models/GwTenant.cs
参考模式: Fengling.Platform.Domain/AggregatesModel/TenantAggregate/Tenant.cs
</action>
<verify>dotnet build 通过</verify>
<done>GwTenant 实体包含 Id, TenantCode, TenantName, Status 字段</done>
</task>
<task type="auto">
<name>任务 3: 创建 GwTenantRoute 实体</name>
<files>Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs</files>
<action>
创建 GwTenantRoute 实体,包含:
- Id (long), TenantCode (string), ServiceName (string)
- ClusterId (string), PathPattern (string), Priority (int)
- Status (int), IsGlobal (bool)
- IsDeleted (bool), Version (int)
- CreatedTime, UpdatedTime, CreatedBy, UpdatedBy
参考源: ../fengling-gateway/src/Models/GwTenantRoute.cs
</action>
<verify>dotnet build 通过</verify>
<done>GwTenantRoute 实体包含路由配置字段</done>
</task>
<task type="auto">
<name>任务 4: 创建 GwServiceInstance 实体</name>
<files>Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs</files>
<action>
创建 GwServiceInstance 实体,包含:
- Id (long), ClusterId (string), DestinationId (string)
- Address (string), Health (int), Weight (int)
- Status (int)
- IsDeleted (bool), Version (int)
- CreatedTime, UpdatedTime, CreatedBy, UpdatedBy
参考源: ../fengling-gateway/src/Models/GwServiceInstance.cs
</action>
<verify>dotnet build 通过</verify>
<done>GwServiceInstance 实体包含实例管理字段</done>
</task>
</tasks>
## 验证
- [ ] 所有 4 个实体文件已创建
- [ ] Build 无错误通过
- [ ] 实体遵循 Platform 约定 (long ID, PascalCase, 时间戳)
## 成功标准
领域实体准备好进行基础设施层实现。