105 lines
3.2 KiB
Markdown
105 lines
3.2 KiB
Markdown
---
|
||
phase: 03-
|
||
plan: 02
|
||
type: execute
|
||
wave: 1
|
||
depends_on:
|
||
- 03-gateway-cluster-entities
|
||
files_modified:
|
||
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs
|
||
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs
|
||
- Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs
|
||
autonomous: true
|
||
requirements:
|
||
- GATEWAY-RESTRUCTURE-03
|
||
- GATEWAY-RESTRUCTURE-04
|
||
must_haves:
|
||
truths:
|
||
- "GwTenantRoute 扩展了 Methods, Hosts, Headers, Transforms 等字段"
|
||
- "旧实体 GwTenant 和 GwServiceInstance 标记为删除或移除"
|
||
artifacts:
|
||
- path: "Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs"
|
||
provides: "扩展的路由实体"
|
||
min_lines: 50
|
||
---
|
||
|
||
# 计划 02: 扩展 GwTenantRoute 并删除旧实体
|
||
|
||
## 目标
|
||
|
||
扩展 GwTenantRoute 实体以支持完整的路由匹配能力和转换规则,并删除已废弃的 GwTenant 和 GwServiceInstance 实体。
|
||
|
||
**目的:** 添加 YARP 所需的路由匹配字段,同时清理不再需要的实体。
|
||
|
||
**输出:** 更新的 GwTenantRoute.cs,删除的 GwTenant.cs 和 GwServiceInstance.cs。
|
||
|
||
## 上下文
|
||
|
||
@.planning/phases/03-/03-CONTEXT.md
|
||
@Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs (现有)
|
||
|
||
## 任务
|
||
|
||
<task type="auto">
|
||
<name>任务 1: 扩展 GwTenantRoute 字段</name>
|
||
<files>Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs</files>
|
||
<action>
|
||
在 GwTenantRoute 中添加以下新字段:
|
||
|
||
1. 路由匹配能力:
|
||
- Methods?: string (HTTP 方法,如 "GET,POST")
|
||
- Hosts?: string (Host 头匹配,如 "api.example.com")
|
||
- Headers?: string (Header 匹配规则,JSON 格式)
|
||
|
||
2. 策略配置:
|
||
- LoadBalancingPolicy?: string (路由级别负载均衡策略覆盖)
|
||
- AuthorizationPolicy?: string (授权策略)
|
||
- CorsPolicy?: string (CORS 策略)
|
||
|
||
3. 请求转换:
|
||
- Transforms?: string (请求/响应转换规则,JSON 格式)
|
||
|
||
保留现有字段:Id, TenantCode, ServiceName, ClusterId, PathPattern, Priority, Status, IsGlobal
|
||
</action>
|
||
<verify>dotnet build 通过</verify>
|
||
<done>GwTenantRoute 已扩展新字段</done>
|
||
</task>
|
||
|
||
<task type="auto">
|
||
<name>任务 2: 删除 GwTenant 实体</name>
|
||
<files>
|
||
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs
|
||
</files>
|
||
<action>
|
||
删除 GwTenant.cs 文件:
|
||
- 原因:使用 Platform.Tenant 通过 TenantCode 关联
|
||
- 确认无其他依赖引用此实体
|
||
</action>
|
||
<verify>dotnet build 通过</verify>
|
||
<done>GwTenant 实体已删除</done>
|
||
</task>
|
||
|
||
<task type="auto">
|
||
<name>任务 3: 删除 GwServiceInstance 实体</name>
|
||
<files>
|
||
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs
|
||
</files>
|
||
<action>
|
||
删除 GwServiceInstance.cs 文件:
|
||
- 原因:改用 GwCluster 聚合根内嵌 Destination
|
||
- 确认无其他依赖引用此实体
|
||
</action>
|
||
<verify>dotnet build 通过</verify>
|
||
<done>GwServiceInstance 实体已删除</done>
|
||
</task>
|
||
|
||
## 验证
|
||
|
||
- [ ] GwTenantRoute 扩展字段已添加
|
||
- [ ] GwTenant.cs 已删除
|
||
- [ ] GwServiceInstance.cs 已删除
|
||
- [ ] Build 无错误通过
|
||
|
||
## 成功标准
|
||
|
||
Domain 层实体重构完成,准备进行 Infrastructure 层更新。 |