49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using AutoMapper;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using PARR.API.Contracts.V1;
|
|
using PARR.API.Contracts.V1.Responses.Base;
|
|
using PARR.API.Controllers.V1.Base;
|
|
using PARR.Core.Services.RobotStatusDetails.Interfaces;
|
|
using PARR.Domain.Common.Roles;
|
|
using PARR.Domain.Enums;
|
|
|
|
namespace PARR.API.Controllers.V1.Statistics
|
|
{
|
|
/// <summary>
|
|
/// Детальная статистика по статусам заданий роботам
|
|
/// </summary>
|
|
[Authorize(Roles = ParrRoles.EsppRobot.RoleOrAdmin)]
|
|
public class StatRobotStatusDetailsController : BaseApiController
|
|
{
|
|
private readonly IMapper _mapper;
|
|
private readonly IRobotStatusDetailsService _robotStatusDetailsService;
|
|
|
|
public StatRobotStatusDetailsController(
|
|
IMapper mapper,
|
|
IRobotStatusDetailsService robotStatusDetailsService
|
|
)
|
|
{
|
|
_mapper = mapper;
|
|
_robotStatusDetailsService = robotStatusDetailsService;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Список групп работ по статусам заданий роботам
|
|
/// </summary>
|
|
/// <param name="robot"></param>
|
|
/// <param name="status"></param>
|
|
/// <returns></returns>
|
|
[HttpGet(ApiRoutes.StatRobotStatusDetails.Details)]
|
|
public async Task<IActionResult> Details([FromRoute] RobotsEnum robot, [FromRoute] RobotStatusEnum status)
|
|
{
|
|
var details = await _robotStatusDetailsService.GetDetailsAsync(robot, status);
|
|
var response = _mapper.Map<StatRobotStatusDetailsResponse>(details);
|
|
|
|
return Ok(new Response<StatRobotStatusDetailsResponse>(response, true));
|
|
}
|
|
|
|
}
|
|
}
|