DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/DrillFlowChartController.cs

53 lines
2.1 KiB
C#
Raw Normal View History

2022-04-11 18:00:34 +05:00
using AsbCloudApp.Data;
using AsbCloudApp.Services;
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>
2022-06-16 17:37:10 +05:00
/// Коридоры бурения для панели бурильщика
/// </summary>
[ApiController]
[Route("api/[controller]")]
[Authorize]
public class DrillFlowChartController : CrudWellRelatedController<DrillFlowChartDto, IDrillFlowChartRepository>
{
private readonly ITelemetryService telemetryService;
public DrillFlowChartController(IWellService wellService, IDrillFlowChartRepository service,
ITelemetryService telemetryService)
2022-06-15 14:57:37 +05:00
: base(wellService, service)
{
this.telemetryService = telemetryService;
}
2022-04-11 18:00:34 +05:00
/// <summary>
/// Возвращает все значения для коридоров бурения по uid панели
/// </summary>
/// <param name="uid"> uid панели </param>
/// <param name="updateFrom"> Дата, с которой следует искать новые параметры </param>
/// <param name="token"> Токен отмены задачи </param>
/// <returns> Список параметров для коридоров бурения </returns>
2021-10-14 11:46:17 +05:00
[HttpGet]
[Route("/api/telemetry/{uid}/drillFlowChart")]
[AllowAnonymous]
2022-04-11 18:00:34 +05:00
[ProducesResponseType(typeof(IEnumerable<DrillFlowChartDto>), (int)System.Net.HttpStatusCode.OK)]
2021-10-14 11:46:17 +05:00
public async Task<IActionResult> GetByTelemetryAsync(string uid, DateTime updateFrom = default, CancellationToken token = default)
{
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
if (idWell is null)
return BadRequest($"Wrong uid {uid}");
2022-04-11 18:00:34 +05:00
var dto = await service.GetAllAsync((int)idWell,
updateFrom, token);
2022-04-11 18:00:34 +05:00
return Ok(dto);
}
2022-04-11 18:00:34 +05:00
}
}