55 lines
2.9 KiB
C#
55 lines
2.9 KiB
C#
namespace ItWorx.KnowledgeHub.Application.Infrastructure.UseCases;
|
|
|
|
public sealed class GetInfrastructureOverviewUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<InfrastructureOverviewData> ExecuteAsync(Guid workspaceId, CancellationToken cancellationToken) =>
|
|
infrastructure.GetOverviewAsync(workspaceId, cancellationToken);
|
|
}
|
|
/// <summary>Unpaginated full-graph listing — reserved for the curated-import matcher
|
|
/// (see <see cref="IInfrastructureRepository.ListServicesAsync"/>'s own doc comment).
|
|
/// Not used by any HTTP endpoint since V2-R2; kept for that one internal caller.
|
|
/// </summary>
|
|
public sealed class ListInfrastructureServicesUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<IReadOnlyList<InfrastructureServiceGraph>> ExecuteAsync(
|
|
Guid workspaceId, bool includeHidden, CancellationToken cancellationToken) =>
|
|
infrastructure.ListServicesAsync(workspaceId, includeHidden, cancellationToken);
|
|
}
|
|
|
|
/// <summary>Cursor-paginated, summary-only catalog listing (V2-R2,
|
|
/// docs/adr/ADR-026-v2-r2-infrastructure-scale-and-sync-durability.md) — what
|
|
/// `GET /infrastructure/services` actually uses now.</summary>
|
|
public sealed class ListInfrastructureServiceSummariesUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<InfrastructureServiceSummaryPage> ExecuteAsync(
|
|
Guid workspaceId, bool includeHidden, Guid? projectId, string? search, string? status, string? cursor, int limit,
|
|
CancellationToken cancellationToken) =>
|
|
infrastructure.ListServiceSummariesAsync(
|
|
workspaceId, includeHidden, projectId, search,
|
|
Enum.TryParse<ServiceCatalogStatus>(status, true, out var parsedStatus) ? parsedStatus : null,
|
|
cursor, limit, cancellationToken);
|
|
}
|
|
|
|
/// <summary>Cursor-paginated, lean-projected storage listing (V2-R2 fields, V2-R5
|
|
/// pagination) — what `GET /infrastructure/storage` actually uses now.</summary>
|
|
public sealed class ListInfrastructureVolumesUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<InfrastructureVolumePage> ExecuteAsync(
|
|
Guid workspaceId, string? search, string? cursor, int limit, CancellationToken cancellationToken) =>
|
|
infrastructure.ListVolumesAsync(workspaceId, search, cursor, limit, cancellationToken);
|
|
}
|
|
|
|
public sealed class GetInfrastructureServiceUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<InfrastructureServiceGraph?> ExecuteAsync(
|
|
Guid workspaceId, Guid serviceId, CancellationToken cancellationToken) =>
|
|
infrastructure.GetServiceAsync(workspaceId, serviceId, cancellationToken);
|
|
}
|
|
|
|
public sealed class ListInfrastructureChangesUseCase(IInfrastructureRepository infrastructure)
|
|
{
|
|
public Task<IReadOnlyList<Domain.Infrastructure.InventoryChange>> ExecuteAsync(
|
|
Guid workspaceId, int limit, CancellationToken cancellationToken) =>
|
|
infrastructure.ListChangesAsync(workspaceId, Math.Clamp(limit, 1, 500), cancellationToken);
|
|
}
|