feat(core, api): Workload - Controller для формирования отчетов

This commit is contained in:
Mikhail Trubnikov
2026-05-07 10:33:53 +10:00
parent eb6036f2c9
commit 277bf0caa3
14 changed files with 210 additions and 78 deletions

View File

@@ -0,0 +1,90 @@
using PARR.Domain.Enums;
namespace PARR.API.Contracts.V1.Responses.Statistics
{
/// <summary>
/// Response отчета о загруженности
/// </summary>
public record StatWorkloadReportResponse
{
/// <summary>
/// Тип отчета (все ЗО, все РГ, одна ЗО, одна РГ)
/// </summary>
public WorkloadReportType Type { get; init; }
/// <summary>
/// Название отчета (По всем ЗО, по одной ЗО)
/// </summary>
public required string DisplayName { get; init; }
/// <summary>
/// Подзаголовок, наименование конкретной ЗО/РГ
/// </summary>
public string? SubfilterName { get; init; }
/// <summary>
/// Дата формирования отчета
/// </summary>
public DateTimeOffset ReportCacheCreatedAt { get; init; }
/// <summary>
/// Дата формирования кэша ЗО и РГ
/// </summary>
public DateTimeOffset TemplateCacheCreatedAt { get; init; }
/// <summary>
/// Список дней
/// </summary>
public required List<WorkloadDayItemResponse> Days { get; init; }
/// <summary>
/// Нагруженность
/// </summary>
public required List<WorkloadStatisticItemResponse> Statistics { get; init; }
}
public record WorkloadSummaryResponse
{
public required WorkloadSummaryItemResponse Total { get; init; }
public required WorkloadSummaryItemResponse Activated { get; init; }
public required WorkloadSummaryItemResponse Deactivated { get; init; }
}
public record WorkloadSummaryItemResponse
{
public int Count { get; init; }
public double Average { get; init; }
}
public record WorkloadDayItemResponse
{
public DateOnly Date { get; init; }
public bool IsWeekend { get; init; }
}
public record WorkloadStatisticItemResponse
{
public required string Title { get; init; }
public required WorkloadSummaryResponse Summary { get; init; }
public required List<WorkloadDailyItemResponse> DailyMetrics { get; init; }
}
public record WorkloadDailyItemResponse
{
public DateOnly Date { get; init; }
public bool IsWeekend { get; init; }
public int Total { get; init; }
public int Activated { get; init; }
public int Deactivated { get; init; }
}
}