forked from ddrilling/AsbCloudServer
Merge branch 'dev' into feature/fix_well_update
This commit is contained in:
commit
dbe461ddd7
24
AsbCloudApp/Requests/GtrWithGetDataRequest.cs
Normal file
24
AsbCloudApp/Requests/GtrWithGetDataRequest.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Параметры запроса для получения загруженных данных ГТИ по скважине
|
||||
/// </summary>
|
||||
public class GtrWithGetDataRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Дата начала выборки.По умолчанию: текущее время - IntervalSec
|
||||
/// </summary>
|
||||
public DateTime? Begin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Интервал времени даты начала выборки, секунды
|
||||
/// </summary>
|
||||
public int IntervalSec { get; set; } = 600;
|
||||
|
||||
/// <summary>
|
||||
/// Желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.
|
||||
/// </summary>
|
||||
public int ApproxPointsCount { get; set; } = 1024;
|
||||
}
|
29
AsbCloudApp/Requests/ReportParametersRequest.cs
Normal file
29
AsbCloudApp/Requests/ReportParametersRequest.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Параметры для создания отчёта и получения прогнозируемого количества страниц будущего отчета
|
||||
/// </summary>
|
||||
public class ReportParametersRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Шаг интервала
|
||||
/// </summary>
|
||||
public int StepSeconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// формат отчета (0-PDF, 1-LAS)
|
||||
/// </summary>
|
||||
public int Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата начала интервала
|
||||
/// </summary>
|
||||
public DateTime Begin { get; set; } = default;
|
||||
|
||||
/// <summary>
|
||||
/// Дата окончания интервала
|
||||
/// </summary>
|
||||
public DateTime End { get; set; } = default;
|
||||
}
|
@ -31,7 +31,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPost]
|
||||
[Route("/merge/{idFrom}/{idTo}")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token = default)
|
||||
public async Task<IActionResult> MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token)
|
||||
{
|
||||
var count = await telemetryService.MergeAsync(idFrom, idTo, token)
|
||||
.ConfigureAwait(false);
|
||||
|
@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPost("login")]
|
||||
[SwaggerOperation(OperationId = "login")]
|
||||
[ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> LoginAsync([FromBody] AuthDto auth, CancellationToken token = default)
|
||||
public async Task<IActionResult> LoginAsync([FromBody] AuthDto auth, CancellationToken token)
|
||||
{
|
||||
var userToken = await authService.LoginAsync(auth.Login, auth.Password, token);
|
||||
|
||||
@ -55,7 +55,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Authorize]
|
||||
[HttpGet("refresh")]
|
||||
[ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> RefreshAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> RefreshAsync(CancellationToken token)
|
||||
{
|
||||
var userToken = await authService.RefreshAsync(User, token);
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DepositDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDepositsAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> GetDepositsAsync(CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -51,7 +51,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet("drillParamsWells")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DepositDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDepositsDrillParamsAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> GetDepositsDrillParamsAsync(CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ClusterDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetClustersAsync(int depositId,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPost("part/{idFileCategory}/user")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddUserAsync(int idWell, [Required] int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token = default)
|
||||
public async Task<IActionResult> AddUserAsync(int idWell, [Required] int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUserEditor = User.GetUserId();
|
||||
@ -224,7 +224,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpDelete("part/{idFileCategory}/user/{idUser}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> RemoveUserAsync(int idWell, int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token = default)
|
||||
public async Task<IActionResult> RemoveUserAsync(int idWell, int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUserEditor = User.GetUserId();
|
||||
|
@ -7,8 +7,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudInfrastructure.Repository;
|
||||
using AsbCloudApp.Repositories;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
@ -44,7 +42,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> SaveFilesAsync(int idWell, int idCategory,
|
||||
[FromForm] IFormFileCollection files, [FromServices] IUserRepository userRepository, CancellationToken token = default)
|
||||
[FromForm] IFormFileCollection files, [FromServices] IUserRepository userRepository, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUser = User.GetUserId();
|
||||
@ -81,7 +79,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ProducesResponseType(typeof(PaginationContainer<FileInfoDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFilesInfoAsync(
|
||||
[FromQuery] FileRequest request,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -108,7 +106,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFileAsync(
|
||||
int idFile, CancellationToken token = default)
|
||||
int idFile, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -142,7 +140,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idFile,
|
||||
[FromServices] IUserRepository userRepository,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idUser = User.GetUserId();
|
||||
|
||||
@ -174,7 +172,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost("fileMark")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> CreateFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token = default)
|
||||
public async Task<IActionResult> CreateFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -202,7 +200,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteFileMarkAsync(int idWell, int idMark,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -226,7 +224,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Route("/api/files/{idFile}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(FileInfoDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetFileInfoAsync([FromRoute] int idFile, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetFileInfoAsync([FromRoute] int idFile, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet("stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<LimitingParameterDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatAsync([FromQuery] LimitingParameterRequest request, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetStatAsync([FromQuery] LimitingParameterRequest request, CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
|
@ -27,7 +27,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("categories")]
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -39,7 +39,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("last/{idCategory}")]
|
||||
public async Task<IActionResult> GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -58,7 +58,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[Route("history")]
|
||||
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, int? idCategory = null, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetHisoryAsync([FromRoute] int idWell, CancellationToken token,
|
||||
int? idCategory = null)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -69,7 +70,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
public async Task<IActionResult> InsertAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
|
||||
public async Task<IActionResult> InsertAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -80,7 +81,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
|
||||
[HttpPut]
|
||||
[Permission]
|
||||
public async Task<IActionResult> UpdateAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
|
||||
public async Task<IActionResult> UpdateAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -92,7 +93,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpDelete]
|
||||
[Permission]
|
||||
[Route("history/{idData}")]
|
||||
public async Task<IActionResult> MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token = default)
|
||||
public async Task<IActionResult> MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -101,7 +102,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
|
@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(ClusterRopStatDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetClusterRopStatByIdWellAsync([FromRoute] int idWell,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -58,7 +58,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ProducesResponseType(typeof(ClusterRopStatDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> GetClusterRopStatByUidAsync([FromRoute] string uid,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var idWell = wellService.TelemetryService.GetIdWellByTelemetryUid(uid);
|
||||
|
||||
@ -82,7 +82,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
if (idCompany is null)
|
||||
@ -128,7 +128,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatWellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatWellAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -149,7 +149,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<PlanFactPredictBase<WellOperationDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTvdAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -159,7 +159,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
|
@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Route("export")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
@ -120,7 +120,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Route("getRows")]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryGeoPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
@ -140,7 +140,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Route("addRow")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddAsync(int idWell, [FromBody] TrajectoryGeoPlanDto row,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -164,7 +164,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Route("addRangeRows")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddRangeAsync(int idWell, [FromBody] IEnumerable<TrajectoryGeoPlanDto> rows,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -191,7 +191,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPut("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync(int idWell, int idRow,
|
||||
[FromBody] TrajectoryGeoPlanDto row, CancellationToken token = default)
|
||||
[FromBody] TrajectoryGeoPlanDto row, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -214,7 +214,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>количество успешно удаленных строк из БД</returns>
|
||||
[HttpDelete("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idRow, CancellationToken token = default)
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idRow, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
@ -243,7 +243,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
|
@ -3,10 +3,11 @@ using AsbCloudApp.Services;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Requests;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
@ -34,19 +35,16 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Создает отчет по скважине с указанными параметрами
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="stepSeconds">шаг интервала</param>
|
||||
/// <param name="format">формат отчета (0-PDF, 1-LAS)</param>
|
||||
/// <param name="begin">дата начала интервала</param>
|
||||
/// <param name="end">дата окончания интервала</param>
|
||||
/// <param name="idWell">Id скважины</param>
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>id фоновой задачи формирования отчета</returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> CreateReportAsync(int idWell, int stepSeconds, int format,
|
||||
DateTime begin = default, DateTime end = default,
|
||||
CancellationToken token = default)
|
||||
public async Task<IActionResult> CreateReportAsync([Required] int idWell,
|
||||
[FromQuery] ReportParametersRequest request,
|
||||
CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
var idUser = User.GetUserId();
|
||||
@ -54,8 +52,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
if ((idCompany is null) || (idUser is null))
|
||||
return Forbid();
|
||||
|
||||
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false))
|
||||
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
void HandleReportProgressAsync(object progress, string id) =>
|
||||
@ -69,7 +67,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
}, token);
|
||||
|
||||
var id = reportService.EnqueueCreateReportWork(idWell, (int)idUser,
|
||||
stepSeconds, format, begin, end, HandleReportProgressAsync);
|
||||
request.StepSeconds, request.Format, request.Begin, request.End, HandleReportProgressAsync);
|
||||
|
||||
return Ok(id);
|
||||
}
|
||||
@ -83,7 +81,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<string>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAllReportsNamesByWellAsync(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetAllReportsNamesByWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -102,32 +100,29 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <summary>
|
||||
/// Возвращает прогнозируемое количество страниц будущего отчета
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="begin">дата начала интервала</param>
|
||||
/// <param name="end">дата окончания интервала</param>
|
||||
/// <param name="stepSeconds">шаг интервала</param>
|
||||
/// <param name="format">формат отчета (0-PDF, 1-LAS)</param>
|
||||
/// <param name="idWell">Id скважины</param>
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name="token">Токен для отмены задачи</param>
|
||||
/// <returns>прогнозируемое кол-во страниц отчета</returns>
|
||||
[HttpGet]
|
||||
[Route("reportSize")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportSizeAsync(int idWell,
|
||||
int stepSeconds, int format, DateTime begin = default,
|
||||
DateTime end = default, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetReportSizeAsync([Required] int idWell,
|
||||
[FromQuery] ReportParametersRequest request,
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false))
|
||||
if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
|
||||
int reportSize = reportService.GetReportPagesCount(idWell,
|
||||
begin, end, stepSeconds, format);
|
||||
request.Begin, request.End, request.StepSeconds, request.Format);
|
||||
|
||||
return Ok(reportSize);
|
||||
}
|
||||
@ -142,7 +137,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Route("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetReportsDateRangeAsync(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetReportsDateRangeAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -5,7 +5,6 @@ using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -38,7 +37,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <returns></returns>
|
||||
[HttpGet("categories")]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellOperationCategoryDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromQuery] int? idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetCategoriesAsync([FromQuery] int? idWell, CancellationToken token)
|
||||
{
|
||||
var result = await detectedOperationService.GetCategoriesAsync(idWell, token);
|
||||
return Ok(result);
|
||||
@ -54,7 +53,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[ProducesResponseType(typeof(DetectedOperationListDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(
|
||||
[FromQuery] DetectedOperationRequest request,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
@ -73,7 +72,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[ProducesResponseType(typeof(IEnumerable<DetectedOperationStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatAsync(
|
||||
[FromQuery] DetectedOperationRequest request,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
@ -125,7 +124,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[Route("export")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> ExportAsync(int? idWell, int? idCluster, CancellationToken token = default)
|
||||
public async Task<IActionResult> ExportAsync(int? idWell, int? idCluster, CancellationToken token)
|
||||
{
|
||||
if (idCluster is null && idWell is null)
|
||||
return this.MakeBadRequest(nameof(idWell), $"One of {nameof(idWell)} or {nameof(idCluster)} mast be set.");
|
||||
|
@ -1,14 +1,14 @@
|
||||
using AsbCloudApp.Data.GTR;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudWebApi.SignalR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Requests;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.SAUB
|
||||
{
|
||||
@ -40,16 +40,15 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <summary>
|
||||
/// Получить загруженные данные ГТИ по скважине
|
||||
/// </summary>
|
||||
/// <param name = "idWell" > id скважины</param>
|
||||
/// <param name = "begin" > дата начала выборки.По умолчанию: текущее время - intervalSec</param>
|
||||
/// <param name = "intervalSec" > интервал времени даты начала выборки, секунды</param>
|
||||
/// <param name = "approxPointsCount" > желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.</param>
|
||||
/// <param name = "token" > Токен завершения задачи</param>
|
||||
/// <param name="idWell">Id скважины</param>
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name = "token" >Токен завершения задачи</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}")]
|
||||
[Permission]
|
||||
public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync(int idWell, DateTime? begin,
|
||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
public async Task<ActionResult<IEnumerable<WitsRecordDto>>> GetDataAsync([Required] int idWell,
|
||||
[FromQuery] GtrWithGetDataRequest request,
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -62,8 +61,8 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
||||
var content = await gtrRepository.GetAsync(idWell, begin,
|
||||
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
||||
var content = await gtrRepository.GetAsync(idWell, request.Begin,
|
||||
request.IntervalSec, request.ApproxPointsCount, token).ConfigureAwait(false);
|
||||
|
||||
return Ok(content);
|
||||
}
|
||||
@ -107,7 +106,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
public async Task<IActionResult> PostDataAsync(
|
||||
string uid,
|
||||
[FromBody] IEnumerable<WitsRecordDto> dtos,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
|
||||
await gtrRepository.SaveDataAsync(telemetry.Id, dtos, token).ConfigureAwait(false);
|
||||
|
@ -2,8 +2,6 @@
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -38,7 +36,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
public async Task<IActionResult> GetMessagesAsync(
|
||||
[FromRoute] int idWell,
|
||||
[FromQuery] MessageRequestBase request,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
|
||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||
@ -70,7 +68,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[Route("datesRange")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetMessagesDateRangeAsync(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetMessagesDateRangeAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[HttpPost("api/well/{idWell}/setpoints")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> InsertAsync(int idWell, SetpointsRequestDto setpoints, CancellationToken token = default)
|
||||
public async Task<IActionResult> InsertAsync(int idWell, SetpointsRequestDto setpoints, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUser = User.GetUserId();
|
||||
@ -90,7 +90,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[HttpGet("api/well/{idWell}/setpoints")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<SetpointsRequestDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetByIdWellAsync([FromRoute] int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetByIdWellAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUser = User.GetUserId();
|
||||
@ -116,7 +116,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[HttpPut("api/telemetry/{uid}/setpoints/{id}")]
|
||||
[ProducesResponseType(typeof(SetpointsRequestDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> UpdateByTelemetryUidAsync([FromRoute] string uid, int id, SetpointsRequestDto setpointsRequestDto, CancellationToken token = default)
|
||||
public async Task<IActionResult> UpdateByTelemetryUidAsync([FromRoute] string uid, int id, SetpointsRequestDto setpointsRequestDto, CancellationToken token)
|
||||
{
|
||||
var result = await setpointsService.UpdateStateAsync(setpointsRequestDto, token)
|
||||
.ConfigureAwait(false);
|
||||
@ -134,7 +134,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[HttpGet("api/telemetry/{uid}/setpoints")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SetpointsRequestDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> GetByTelemetryUidAsync([FromRoute] string uid, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetByTelemetryUidAsync([FromRoute] string uid, CancellationToken token)
|
||||
{
|
||||
var result = await setpointsService.GetForPanelAsync(uid, token)
|
||||
.ConfigureAwait(false);
|
||||
@ -151,7 +151,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <returns>1 - удалено, 0 и меньше - не удалено</returns>
|
||||
[HttpDelete("api/well/{idWell}/setpoints/{id}")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> TryDeleteByIdWellAsync(int idWell, int id, CancellationToken token = default)
|
||||
public async Task<IActionResult> TryDeleteByIdWellAsync(int idWell, int id, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
int? idUser = User.GetUserId();
|
||||
|
@ -48,7 +48,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[Route("{uid}")]
|
||||
[AllowAnonymous]
|
||||
public virtual async Task<IActionResult> PostDataAsync(string uid, [FromBody] IEnumerable<TDto> dtos,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
await telemetryDataService.UpdateDataAsync(uid, dtos, token).ConfigureAwait(false);
|
||||
|
||||
@ -72,8 +72,12 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
/// <returns></returns>
|
||||
[HttpGet("{idWell}")]
|
||||
[Permission]
|
||||
public virtual async Task<ActionResult<IEnumerable<TDto>>> GetDataAsync(int idWell, DateTime begin = default,
|
||||
int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
public virtual async Task<ActionResult<IEnumerable<TDto>>> GetDataAsync(int idWell,
|
||||
DateTime begin = default,
|
||||
int intervalSec = 600,
|
||||
int approxPointsCount = 1024,
|
||||
//TODO: сделать cancellationToken обязательным
|
||||
CancellationToken token = default)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
@ -103,7 +107,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<ActionResult<DatesRangeDto>> GetDataDatesRangeAsync(int idWell,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
/// </summary>
|
||||
[HttpGet("stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SubsystemStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetStatAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
@ -62,7 +62,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
/// <returns> </returns>
|
||||
[HttpGet("statByActiveWell")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SubsystemActiveWellStatDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatByWellAsync(DateTime? GtDate, DateTime? LtDate, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetStatByWellAsync(DateTime? GtDate, DateTime? LtDate, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
if (!idCompany.HasValue)
|
||||
@ -76,7 +76,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
/// </summary>
|
||||
[HttpGet("subsystem")]
|
||||
[ProducesResponseType(typeof(IEnumerable<SubsystemDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetSubsystemAsync([FromQuery] int? idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetSubsystemAsync([FromQuery] int? idWell, CancellationToken token)
|
||||
{
|
||||
if (idWell.HasValue)
|
||||
if (!await UserHasAccesToWellAsync(idWell.Value, token))
|
||||
@ -90,7 +90,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
/// </summary>
|
||||
[HttpGet("datesRange")]
|
||||
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDateRangeOperationTimeAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetDateRangeOperationTimeAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
@ -106,7 +106,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
|
||||
|
||||
public async Task<IActionResult> GetOperationTimeAsync(
|
||||
[FromQuery] SubsystemOperationTimeRequest request,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
|
@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers.WITS
|
||||
string uid,
|
||||
[FromBody] IEnumerable<TDto> dtos,
|
||||
[FromServices] IWitsRecordRepository<TDto> witsRecordRepository,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
|
||||
await witsRecordRepository.SaveDataAsync(telemetry.Id, dtos, token).ConfigureAwait(false);
|
||||
|
@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellCompositeDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -56,7 +56,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Permission]
|
||||
public async Task<IActionResult> SaveAsync(int idWell, IEnumerable<WellCompositeDto> wellComposites, CancellationToken token = default)
|
||||
public async Task<IActionResult> SaveAsync(int idWell, IEnumerable<WellCompositeDto> wellComposites, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -74,7 +74,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet("getCompositeProcessMap")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetCompositeProcessMap(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
@ -83,7 +83,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
|
@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<WellDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellsAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> GetWellsAsync(CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -53,7 +53,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns>Список скважин</returns>
|
||||
[HttpGet("wellTree")]
|
||||
[ProducesResponseType(typeof(IEnumerable<DepositBranchDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetWellTreeAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> GetWellTreeAsync(CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -75,7 +75,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet("{idWell}")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(WellDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -100,7 +100,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateWellAsync(WellDto dto,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
@ -127,7 +127,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateWellStateAsync(int idWell,
|
||||
[Range(0, 2, ErrorMessage = "Статус некорректен")] int idState,
|
||||
CancellationToken token = default)
|
||||
CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
|
||||
|
@ -163,7 +163,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Route("wellCaseCategories")]
|
||||
[Permission]
|
||||
public async Task<IActionResult> GetWellCaseCategoriesAsync(CancellationToken token = default)
|
||||
public async Task<IActionResult> GetWellCaseCategoriesAsync(CancellationToken token)
|
||||
{
|
||||
var data = await fileCategoryService.GetWellCaseCategoriesAsync(token);
|
||||
return Ok(data);
|
||||
|
Loading…
Reference in New Issue
Block a user