feat(api,core,domain): RobotSnapshot - почасовой отчет о загрузке роботов

This commit is contained in:
Mikhail Trubnikov
2026-06-11 14:44:39 +10:00
parent 3b6df1f617
commit 19cb6b50bf
6 changed files with 243 additions and 2 deletions

View File

@@ -10,9 +10,11 @@ using PARR.Core.Common.Interfaces;
using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Unit;
using PARR.Core.Services.NextRunServices;
using PARR.Core.Services.RobotSnapshotServices;
using PARR.Core.Services.UnitService.Interfaces;
using PARR.Core.Services.Workload.Implementations;
using PARR.Domain.Cache;
using PARR.Domain.DTOs.RobotSnapshotDTO;
namespace PARR.API.Controllers.V1
{
@@ -27,6 +29,7 @@ namespace PARR.API.Controllers.V1
private readonly ILogger<TestController> logger;
private readonly IUnitService unitService;
private readonly IUnitRepository unitRepository;
private readonly IRobotSnapshotService _robotSnapshotService;
public TestController(
IClientService clientService,
@@ -37,7 +40,8 @@ namespace PARR.API.Controllers.V1
WorkloadCacheService workloadCacheService,
ILogger<TestController> logger,
IUnitService unitService,
IUnitRepository unitRepository
IUnitRepository unitRepository,
IRobotSnapshotService robotSnapshotService
)
{
this.clientService = clientService;
@@ -48,6 +52,7 @@ namespace PARR.API.Controllers.V1
this.logger = logger;
this.unitService = unitService;
this.unitRepository = unitRepository;
_robotSnapshotService = robotSnapshotService;
}
@@ -161,6 +166,22 @@ namespace PARR.API.Controllers.V1
}
/// <summary>
/// Тестовый метод
/// </summary>
/// <returns></returns>
[HttpGet(ApiRoutes.Test.TestHandler)]
public async Task<IActionResult> Test()
{
var data = await _robotSnapshotService.GetHourlyAnalyticsAsync(new RobotAnalyticsQuery
{
DateStart = DateTimeOffset.UtcNow.AddHours(-1),
DateEnd = DateTimeOffset.UtcNow,
Offset = TimeSpan.FromMinutes(600)
});
return Ok(data);
}