forked from ddrilling/AsbCloudServer
#8636739 Изменение контроллера
This commit is contained in:
parent
4192254072
commit
7d94945c9f
@ -4,6 +4,7 @@ using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ProtoBuf.Meta;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
@ -23,12 +24,17 @@ namespace AsbCloudWebApi.Controllers
|
||||
private readonly IWellService wellService;
|
||||
private readonly IPlannedTrajectoryImportService plannedTrajectoryImportService;
|
||||
private readonly IPlannedTrajectoryRepository plannedTrajectoryRepository;
|
||||
private readonly ITrajectoryVisualizationService trajectoryVisualizationService;
|
||||
|
||||
public PlannedTrajectoryController(IWellService wellService, IPlannedTrajectoryImportService plannedTrajectoryImportService, IPlannedTrajectoryRepository plannedTrajectoryRepository)
|
||||
public PlannedTrajectoryController(IWellService wellService,
|
||||
IPlannedTrajectoryImportService plannedTrajectoryImportService,
|
||||
IPlannedTrajectoryRepository plannedTrajectoryRepository,
|
||||
ITrajectoryVisualizationService trajectoryVisualizationService)
|
||||
{
|
||||
this.plannedTrajectoryImportService = plannedTrajectoryImportService;
|
||||
this.wellService = wellService;
|
||||
this.plannedTrajectoryRepository = plannedTrajectoryRepository;
|
||||
this.trajectoryVisualizationService = trajectoryVisualizationService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -226,6 +232,20 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение координат для визуализации траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryVisualizationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTrajectoryAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var result = await trajectoryVisualizationService.GetTrajectoryAsync(idWell, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
@ -1,34 +0,0 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Визуализация траектории 3D
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class TrajectoryVisualizationController : ControllerBase
|
||||
{
|
||||
private readonly ITrajectoryVisualizationService service;
|
||||
|
||||
public TrajectoryVisualizationController(ITrajectoryVisualizationService service)
|
||||
{
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryVisualizationDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTrajectoryAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var result = await service.GetTrajectoryAsync(idWell, token);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user