forked from ddrilling/AsbCloudServer
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using AsbCloudApp.Data;
|
||
using AsbCloudApp.Exceptions;
|
||
using AsbCloudApp.Requests;
|
||
using AsbCloudApp.Services;
|
||
using AsbCloudDb.Model;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace AsbCloudWebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// Аналитика по удержанию в клиньях
|
||
/// </summary>
|
||
[Route("api/slipsStat")]
|
||
[ApiController]
|
||
[Authorize]
|
||
public class SlipsStatController : ControllerBase
|
||
{
|
||
private readonly ISlipsStatService slipsAnalyticsService;
|
||
|
||
public SlipsStatController(ISlipsStatService slipsAnalyticsService)
|
||
{
|
||
this.slipsAnalyticsService = slipsAnalyticsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Получить аналитику по удержанию в клиньях (по бурильщикам)
|
||
/// </summary>
|
||
/// <param name="request">Параметры запроса</param>
|
||
/// <param name="token"> Токен отмены задачи </param>
|
||
/// <returns>Список бурильщиков</returns>
|
||
[HttpGet]
|
||
[ProducesResponseType(typeof(IEnumerable<SlipsStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||
public async Task<IActionResult> GetAllAsync(
|
||
[FromQuery] OperationStatRequest request,
|
||
CancellationToken token)
|
||
{
|
||
var idUser = User.GetUserId();
|
||
|
||
if (!idUser.HasValue)
|
||
throw new ForbidException("Не удается вас опознать");
|
||
|
||
var data = await slipsAnalyticsService.GetAllAsync(request, token).ConfigureAwait(false);
|
||
return Ok(data);
|
||
}
|
||
}
|
||
}
|
||
|