feat(api,core,domain): Получение снапшотов работы роботов
This commit is contained in:
@@ -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>
|
||||
/// Отправить снапшот роботов.
|
||||
/// Доступ только с ролью "Робот ЕСПП"
|
||||
|
||||
Reference in New Issue
Block a user