DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/SlipsStatController.cs
2024-08-19 10:01:07 +05:00

52 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}