feat(api,core,domain): Получение снапшотов работы роботов

This commit is contained in:
Mikhail Trubnikov
2026-06-11 11:40:12 +10:00
parent d736208a46
commit 7d26f1cf55
13 changed files with 187 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PARR.API.Contracts.V1;
using PARR.API.Contracts.V1.Requests;
using PARR.API.Contracts.V1.Requests.Queries;
using PARR.API.Contracts.V1.Responses.Base;
using PARR.API.Contracts.V1.Responses.Statistics;
using PARR.API.Controllers.V1.Base;
@@ -13,7 +14,7 @@ using PARR.Domain.DTOs.RobotSnapshotDTO;
namespace PARR.API.Controllers.V1.Statistics
{
[Authorize(Roles = ParrRoles.Administrator.Role)]
[Authorize]
public class StatRobotSnapshotController : BaseApiController
{
private readonly IRobotSnapshotService robotSnapshotService;
@@ -31,6 +32,28 @@ namespace PARR.API.Controllers.V1.Statistics
this.clientService = clientService;
}
/// <summary>
/// Получить снапшоты роботов.
/// </summary>
/// <returns></returns>
[Authorize(Roles = ParrRoles.Administrator.Role)]
[HttpGet(ApiRoutes.StatRobotSnapshot.GetAll)]
public async Task<IActionResult> GetAll([FromQuery] StatRobotSnapshotQuery query)
{
var queryDto = mapper.Map<RobotSnapshotQuery>(query);
var snapshots = await robotSnapshotService.GetAsync(queryDto);
if (snapshots.Count == 0)
return NoContent();
var response = mapper.Map<List<StatRobotSnapshotItemResponse>>(snapshots);
return Ok(new Response<List<StatRobotSnapshotItemResponse>>(response, true));
}
/// <summary>
/// Отправить снапшот роботов.
/// Доступ только с ролью "Робот ЕСПП"