--- 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/ (源实体) ## 任务 任务 1: 创建 GatewayEnums Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GatewayEnums.cs 创建网关实体使用的枚举类型: - RouteStatus (Active=1, Inactive=0) - InstanceHealth (Healthy=1, Unhealthy=0) - InstanceStatus (Active=1, Inactive=0) 参考现有: Fengling.Platform.Domain/AggregatesModel/TenantAggregate/Tenant.cs 文件可编译,枚举可访问 GatewayEnums.cs 已创建,包含 RouteStatus, InstanceHealth, InstanceStatus 任务 2: 创建 GwTenant 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs 创建 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 dotnet build 通过 GwTenant 实体包含 Id, TenantCode, TenantName, Status 字段 任务 3: 创建 GwTenantRoute 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs 创建 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 dotnet build 通过 GwTenantRoute 实体包含路由配置字段 任务 4: 创建 GwServiceInstance 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs 创建 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 dotnet build 通过 GwServiceInstance 实体包含实例管理字段 ## 验证 - [ ] 所有 4 个实体文件已创建 - [ ] Build 无错误通过 - [ ] 实体遵循 Platform 约定 (long ID, PascalCase, 时间戳) ## 成功标准 领域实体准备好进行基础设施层实现。