using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.Trajectory;
using AsbCloudInfrastructure.Services.Trajectory.Export;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudInfrastructure.Services.Trajectory.Parser;
namespace AsbCloudWebApi.Controllers.Trajectory;
///
/// Плановая траектория (загрузка и хранение)
///
[Route("api/well/{idWell}/[controller]")]
[ApiController]
public class TrajectoryPlanController : TrajectoryEditableController
{
private readonly TrajectoryService trajectoryVisualizationService;
protected override string TemplateFileName => "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
public TrajectoryPlanController(IWellService wellService,
TrajectoryPlanParser parserService,
TrajectoryPlanExportService trajectoryExportService,
ITrajectoryEditableRepository trajectoryRepository,
TrajectoryService trajectoryVisualizationService)
: base(wellService, parserService, trajectoryExportService, trajectoryRepository)
{
this.trajectoryVisualizationService = trajectoryVisualizationService;
}
///
/// Получение координат для визуализации траектории (плановой и фактической)
///
///
///
///
[HttpGet("trajectoryCartesianPlanFact")]
[ProducesResponseType(
typeof(TrajectoryPlanFactDto, IEnumerable>),
(int)System.Net.HttpStatusCode.OK)]
public async Task GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell,
token).ConfigureAwait(false))
return Forbid();
var result = await trajectoryVisualizationService.GetTrajectoryCartesianAsync(idWell, token);
return Ok(result);
}
}