All checks were successful
Publish Platform NuGet Packages / build (push) Successful in 26s
- 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
36 lines
1.2 KiB
C#
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);
|
|
}
|