From 3fbd9d07a60bc18bc939f7a3fe945b94748c5f85 Mon Sep 17 00:00:00 2001 From: movingsam Date: Tue, 3 Mar 2026 15:36:37 +0800 Subject: [PATCH] feat(03-gateway-route-update): extend GwTenantRoute and delete obsolete entities - Add Methods, Hosts, Headers, LoadBalancingPolicy, AuthorizationPolicy, CorsPolicy, Transforms fields to GwTenantRoute - Delete GwTenant entity (use Platform.Tenant instead) - Delete GwServiceInstance entity (use GwCluster embedded Destination) --- .../GatewayAggregate/GwServiceInstance.cs | 69 ------------------- .../GatewayAggregate/GwTenant.cs | 54 --------------- .../GatewayAggregate/GwTenantRoute.cs | 41 +++++++++++ 3 files changed, 41 insertions(+), 123 deletions(-) delete mode 100644 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs delete mode 100644 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs diff --git a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs b/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs deleted file mode 100644 index 23bcbbc..0000000 --- a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs +++ /dev/null @@ -1,69 +0,0 @@ -namespace Fengling.Platform.Domain.AggregatesModel.GatewayAggregate; - -/// -/// 网关服务实例实体 - 表示负载均衡的服务实例 -/// -public class GwServiceInstance -{ - public string Id { get; set; } = Guid.CreateVersion7().ToString("N"); - - /// - /// 集群ID - /// - public string ClusterId { get; set; } = string.Empty; - - /// - /// 目标ID - /// - public string DestinationId { get; set; } = string.Empty; - - /// - /// 地址 - /// - public string Address { get; set; } = string.Empty; - - /// - /// 健康状态 - /// - public int Health { get; set; } = 1; - - /// - /// 权重 - /// - public int Weight { get; set; } = 1; - - /// - /// 状态 - /// - public int Status { get; set; } = 1; - - /// - /// 创建人ID - /// - public long? CreatedBy { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreatedTime { get; set; } = DateTime.UtcNow; - - /// - /// 更新人ID - /// - public long? UpdatedBy { get; set; } - - /// - /// 更新时间 - /// - public DateTime? UpdatedTime { get; set; } - - /// - /// 是否删除 - /// - public bool IsDeleted { get; set; } = false; - - /// - /// 版本号,用于乐观并发 - /// - public int Version { get; set; } = 0; -} diff --git a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs b/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs deleted file mode 100644 index 9556630..0000000 --- a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs +++ /dev/null @@ -1,54 +0,0 @@ -namespace Fengling.Platform.Domain.AggregatesModel.GatewayAggregate; - -/// -/// 网关租户实体 - 表示租户在网关中的配置 -/// -public class GwTenant -{ - public long Id { get; set; } - - /// - /// 租户代码 - /// - public string TenantCode { get; set; } = string.Empty; - - /// - /// 租户名称 - /// - public string TenantName { get; set; } = string.Empty; - - /// - /// 状态 - /// - public int Status { get; set; } = 1; - - /// - /// 创建人ID - /// - public long? CreatedBy { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreatedTime { get; set; } = DateTime.UtcNow; - - /// - /// 更新人ID - /// - public long? UpdatedBy { get; set; } - - /// - /// 更新时间 - /// - public DateTime? UpdatedTime { get; set; } - - /// - /// 是否删除 - /// - public bool IsDeleted { get; set; } = false; - - /// - /// 版本号,用于乐观并发 - /// - public int Version { get; set; } = 0; -} diff --git a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs b/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs index 1a37f93..660a7ea 100644 --- a/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs +++ b/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs @@ -71,4 +71,45 @@ public class GwTenantRoute /// 版本号,用于乐观并发 /// public int Version { get; set; } = 0; + + // ===== 路由匹配能力 ===== + + /// + /// HTTP 方法匹配(如 "GET,POST") + /// + public string? Methods { get; set; } + + /// + /// Host 头匹配(如 "api.example.com") + /// + public string? Hosts { get; set; } + + /// + /// Header 匹配规则(JSON 格式) + /// + public string? Headers { get; set; } + + // ===== 策略配置 ===== + + /// + /// 路由级别负载均衡策略覆盖 + /// + public string? LoadBalancingPolicy { get; set; } + + /// + /// 授权策略 + /// + public string? AuthorizationPolicy { get; set; } + + /// + /// CORS 策略 + /// + public string? CorsPolicy { get; set; } + + // ===== 请求转换 ===== + + /// + /// 请求/响应转换规则(JSON 格式) + /// + public string? Transforms { get; set; } }