feat(03-01): add GwCluster aggregate root

- Created cluster aggregate root with string Id (GUID)
- Includes ClusterId, Name, Description, Destinations list
- Embeds GwHealthCheckConfig and GwSessionAffinityConfig
- Includes audit fields: CreatedBy, CreatedTime, UpdatedBy, UpdatedTime
- Supports IsDeleted soft delete and Version for optimistic concurrency
This commit is contained in:
movingsam 2026-03-03 15:32:41 +08:00
parent 7ec34fa094
commit 774e3fba00

View File

@ -0,0 +1,79 @@
namespace Fengling.Platform.Domain.AggregatesModel.GatewayAggregate;
/// <summary>
/// 网关集群聚合根 - 表示后端服务集群配置
/// </summary>
public class GwCluster
{
public string Id { get; set; } = Guid.CreateVersion7().ToString("N");
/// <summary>
/// 集群业务标识
/// </summary>
public string ClusterId { get; set; } = string.Empty;
/// <summary>
/// 集群名称
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// 描述
/// </summary>
public string? Description { get; set; }
/// <summary>
/// 目标端点列表(内嵌)
/// </summary>
public List<GwDestination> Destinations { get; set; } = new();
/// <summary>
/// 负载均衡策略
/// </summary>
public string LoadBalancingPolicy { get; set; } = "RoundRobin";
/// <summary>
/// 健康检查配置
/// </summary>
public GwHealthCheckConfig? HealthCheck { get; set; }
/// <summary>
/// 会话亲和配置
/// </summary>
public GwSessionAffinityConfig? SessionAffinity { get; set; }
/// <summary>
/// 状态
/// </summary>
public int Status { get; set; } = 1;
/// <summary>
/// 创建人ID
/// </summary>
public long? CreatedBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
/// <summary>
/// 更新人ID
/// </summary>
public long? UpdatedBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdatedTime { get; set; }
/// <summary>
/// 是否删除
/// </summary>
public bool IsDeleted { get; set; } = false;
/// <summary>
/// 版本号,用于乐观并发
/// </summary>
public int Version { get; set; } = 0;
}