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