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