fengling-platform/Fengling.Platform.Infrastructure/RouteManager.cs
Kimi CLI b66b231917
All checks were successful
Publish Platform NuGet Packages / build (push) Successful in 26s
refactor: replace GwTenantRoute with GwRoute, change Id type to string
- Remove GwTenantRoute (old tenant-specific route entity)
- Add GwRoute with string Id (Guid.CreateVersion7)
- Update IRouteManager and IRouteStore interfaces
- Update PlatformDbContext configuration for new schema
- GwRoute is now global, tenant-specific routing moved to GwDestination.TenantCode

BREAKING CHANGE: Database schema change requires table recreation
2026-03-08 15:21:43 +08:00

36 lines
1.2 KiB
C#

using Microsoft.AspNetCore.Identity;
using Fengling.Platform.Domain.AggregatesModel.GatewayAggregate;
namespace Fengling.Platform.Infrastructure;
/// <summary>
/// 路由管理器实现
/// </summary>
public class RouteManager : IRouteManager
{
private readonly IRouteStore _store;
public RouteManager(IRouteStore store)
{
_store = store;
}
public virtual Task<GwRoute?> FindByIdAsync(string? id, CancellationToken cancellationToken = default)
=> _store.FindByIdAsync(id, cancellationToken);
public virtual Task<IList<GwRoute>> GetAllAsync(CancellationToken cancellationToken = default)
=> _store.GetAllAsync(cancellationToken);
public virtual Task<IdentityResult> CreateRouteAsync(GwRoute route, CancellationToken cancellationToken = default)
{
route.CreatedTime = DateTime.UtcNow;
return _store.CreateAsync(route, cancellationToken);
}
public virtual Task<IdentityResult> UpdateRouteAsync(GwRoute route, CancellationToken cancellationToken = default)
=> _store.UpdateAsync(route, cancellationToken);
public virtual Task<IdentityResult> DeleteRouteAsync(GwRoute route, CancellationToken cancellationToken = default)
=> _store.DeleteAsync(route, cancellationToken);
}