diff --git a/AsbCloudApp/Requests/GtrWithGetDataRequest.cs b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
new file mode 100644
index 00000000..8e93a02c
--- /dev/null
+++ b/AsbCloudApp/Requests/GtrWithGetDataRequest.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+/// Параметры запроса для получения загруженных данных ГТИ по скважине
+///
+public class GtrWithGetDataRequest
+{
+ ///
+ /// Дата начала выборки.По умолчанию: текущее время - IntervalSec
+ ///
+ public DateTime? Begin { get; set; }
+
+ ///
+ /// Интервал времени даты начала выборки, секунды
+ ///
+ public int IntervalSec { get; set; } = 600;
+
+ ///
+ /// Желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.
+ ///
+ public int ApproxPointsCount { get; set; } = 1024;
+}
\ No newline at end of file
diff --git a/AsbCloudApp/Requests/ReportParametersRequest.cs b/AsbCloudApp/Requests/ReportParametersRequest.cs
new file mode 100644
index 00000000..d01259d4
--- /dev/null
+++ b/AsbCloudApp/Requests/ReportParametersRequest.cs
@@ -0,0 +1,29 @@
+using System;
+
+namespace AsbCloudApp.Requests;
+
+///
+/// Параметры для создания отчёта и получения прогнозируемого количества страниц будущего отчета
+///
+public class ReportParametersRequest
+{
+ ///
+ /// Шаг интервала
+ ///
+ public int StepSeconds { get; set; }
+
+ ///
+ /// формат отчета (0-PDF, 1-LAS)
+ ///
+ public int Format { get; set; }
+
+ ///
+ /// Дата начала интервала
+ ///
+ public DateTime Begin { get; set; } = default;
+
+ ///
+ /// Дата окончания интервала
+ ///
+ public DateTime End { get; set; } = default;
+}
\ No newline at end of file
diff --git a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs
index b55d623a..b9f30009 100644
--- a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs
+++ b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs
@@ -31,7 +31,7 @@ namespace AsbCloudWebApi.Controllers
[HttpPost]
[Route("/merge/{idFrom}/{idTo}")]
[Permission]
- public async Task MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token = default)
+ public async Task MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token)
{
var count = await telemetryService.MergeAsync(idFrom, idTo, token)
.ConfigureAwait(false);
diff --git a/AsbCloudWebApi/Controllers/AuthController.cs b/AsbCloudWebApi/Controllers/AuthController.cs
index 5318c6ec..ca3143ba 100644
--- a/AsbCloudWebApi/Controllers/AuthController.cs
+++ b/AsbCloudWebApi/Controllers/AuthController.cs
@@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers
[HttpPost("login")]
[SwaggerOperation(OperationId = "login")]
[ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)]
- public async Task LoginAsync([FromBody] AuthDto auth, CancellationToken token = default)
+ public async Task 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 RefreshAsync(CancellationToken token = default)
+ public async Task RefreshAsync(CancellationToken token)
{
var userToken = await authService.RefreshAsync(User, token);
diff --git a/AsbCloudWebApi/Controllers/DepositController.cs b/AsbCloudWebApi/Controllers/DepositController.cs
index f1f89506..9b8d0c91 100644
--- a/AsbCloudWebApi/Controllers/DepositController.cs
+++ b/AsbCloudWebApi/Controllers/DepositController.cs
@@ -31,7 +31,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Permission]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetDepositsAsync(CancellationToken token = default)
+ public async Task GetDepositsAsync(CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -51,7 +51,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet("drillParamsWells")]
[Permission]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetDepositsDrillParamsAsync(CancellationToken token = default)
+ public async Task GetDepositsDrillParamsAsync(CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Controllers
[Permission]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
public async Task GetClustersAsync(int depositId,
- CancellationToken token = default)
+ CancellationToken token)
{
int? idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/DrillingProgramController.cs b/AsbCloudWebApi/Controllers/DrillingProgramController.cs
index fc4eeb11..69944c9d 100644
--- a/AsbCloudWebApi/Controllers/DrillingProgramController.cs
+++ b/AsbCloudWebApi/Controllers/DrillingProgramController.cs
@@ -196,7 +196,7 @@ namespace AsbCloudWebApi.Controllers
[HttpPost("part/{idFileCategory}/user")]
[Permission]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task AddUserAsync(int idWell, [Required] int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token = default)
+ public async Task 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 RemoveUserAsync(int idWell, int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token = default)
+ public async Task RemoveUserAsync(int idWell, int idUser, int idFileCategory, [Required] int idUserRole, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
int? idUserEditor = User.GetUserId();
diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs
index 0bb69891..2a7d6fcb 100644
--- a/AsbCloudWebApi/Controllers/FileController.cs
+++ b/AsbCloudWebApi/Controllers/FileController.cs
@@ -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 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), (int)System.Net.HttpStatusCode.OK)]
public async Task 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 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 DeleteAsync(int idWell, int idFile,
[FromServices] IUserRepository userRepository,
- CancellationToken token = default)
+ CancellationToken token)
{
int? idUser = User.GetUserId();
@@ -174,7 +172,7 @@ namespace AsbCloudWebApi.Controllers
///
[HttpPost("fileMark")]
[Permission]
- public async Task CreateFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token = default)
+ public async Task 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 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 GetFileInfoAsync([FromRoute] int idFile, CancellationToken token = default)
+ public async Task GetFileInfoAsync([FromRoute] int idFile, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/LimitingParameterController.cs b/AsbCloudWebApi/Controllers/LimitingParameterController.cs
index 9bd5784d..7157dd03 100644
--- a/AsbCloudWebApi/Controllers/LimitingParameterController.cs
+++ b/AsbCloudWebApi/Controllers/LimitingParameterController.cs
@@ -32,7 +32,7 @@ namespace AsbCloudWebApi.Controllers
///
[HttpGet("stat")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetStatAsync([FromQuery] LimitingParameterRequest request, CancellationToken token = default)
+ public async Task GetStatAsync([FromQuery] LimitingParameterRequest request, CancellationToken token)
{
if (!await UserHasAccesToWellAsync(request.IdWell, token))
return Forbid();
diff --git a/AsbCloudWebApi/Controllers/MeasureController.cs b/AsbCloudWebApi/Controllers/MeasureController.cs
index dac77733..510a34ca 100644
--- a/AsbCloudWebApi/Controllers/MeasureController.cs
+++ b/AsbCloudWebApi/Controllers/MeasureController.cs
@@ -27,7 +27,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Permission]
[Route("categories")]
- public async Task GetCategoriesAsync([FromRoute] int idWell, CancellationToken token = default)
+ public async Task 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 GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token = default)
+ public async Task 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 GetHisoryAsync([FromRoute] int idWell, int? idCategory = null, CancellationToken token = default)
+ public async Task 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 InsertAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
+ public async Task 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 UpdateAsync([FromRoute] int idWell, MeasureDto data, CancellationToken token = default)
+ public async Task 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 MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token = default)
+ public async Task 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 CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
+ private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
diff --git a/AsbCloudWebApi/Controllers/OperationStatController.cs b/AsbCloudWebApi/Controllers/OperationStatController.cs
index a10dcd93..9fa4f5bd 100644
--- a/AsbCloudWebApi/Controllers/OperationStatController.cs
+++ b/AsbCloudWebApi/Controllers/OperationStatController.cs
@@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Controllers
[Permission]
[ProducesResponseType(typeof(ClusterRopStatDto), (int)System.Net.HttpStatusCode.OK)]
public async Task 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 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 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 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>), (int)System.Net.HttpStatusCode.OK)]
public async Task 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 CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
+ private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
index 1e8b667d..5da1a2c2 100644
--- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
+++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
@@ -61,7 +61,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Route("export")]
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
- public async Task ExportAsync([FromRoute] int idWell, CancellationToken token = default)
+ public async Task 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), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetAsync([FromRoute] int idWell, CancellationToken token = default)
+ public async Task 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 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 AddRangeAsync(int idWell, [FromBody] IEnumerable 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 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
/// количество успешно удаленных строк из БД
[HttpDelete("{idRow}")]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task DeleteAsync(int idWell, int idRow, CancellationToken token = default)
+ public async Task 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 CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
+ private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs
index 8b1081ab..c20db17b 100644
--- a/AsbCloudWebApi/Controllers/ReportController.cs
+++ b/AsbCloudWebApi/Controllers/ReportController.cs
@@ -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
///
/// Создает отчет по скважине с указанными параметрами
///
- /// id скважины
- /// шаг интервала
- /// формат отчета (0-PDF, 1-LAS)
- /// дата начала интервала
- /// дата окончания интервала
+ /// Id скважины
+ /// Параметры запроса
/// Токен для отмены задачи
/// id фоновой задачи формирования отчета
[HttpPost]
[Permission]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task CreateReportAsync(int idWell, int stepSeconds, int format,
- DateTime begin = default, DateTime end = default,
- CancellationToken token = default)
+ public async Task 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), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetAllReportsNamesByWellAsync(int idWell, CancellationToken token = default)
+ public async Task GetAllReportsNamesByWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
@@ -102,32 +100,29 @@ namespace AsbCloudWebApi.Controllers
///
/// Возвращает прогнозируемое количество страниц будущего отчета
///
- /// id скважины
- /// дата начала интервала
- /// дата окончания интервала
- /// шаг интервала
- /// формат отчета (0-PDF, 1-LAS)
+ /// Id скважины
+ /// Параметры запроса
/// Токен для отмены задачи
/// прогнозируемое кол-во страниц отчета
[HttpGet]
[Route("reportSize")]
[Permission]
[ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetReportSizeAsync(int idWell,
- int stepSeconds, int format, DateTime begin = default,
- DateTime end = default, CancellationToken token = default)
+ public async Task 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 GetReportsDateRangeAsync(int idWell, CancellationToken token = default)
+ public async Task GetReportsDateRangeAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs
index ee3ba8f3..02737317 100644
--- a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs
@@ -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
///
[HttpGet("categories")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetCategoriesAsync([FromQuery] int? idWell, CancellationToken token = default)
+ public async Task 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 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), (int)System.Net.HttpStatusCode.OK)]
public async Task 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 ExportAsync(int? idWell, int? idCluster, CancellationToken token = default)
+ public async Task 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.");
diff --git a/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs b/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
index a6cf23a2..aab78cd3 100644
--- a/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/GtrWitsController.cs
@@ -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
///
/// Получить загруженные данные ГТИ по скважине
///
- /// id скважины
- /// дата начала выборки.По умолчанию: текущее время - intervalSec
- /// интервал времени даты начала выборки, секунды
- /// желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.
- /// Токен завершения задачи
+ /// Id скважины
+ /// Параметры запроса
+ /// Токен завершения задачи
///
[HttpGet("{idWell}")]
[Permission]
- public async Task>> GetDataAsync(int idWell, DateTime? begin,
- int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
+ public async Task>> 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 PostDataAsync(
string uid,
[FromBody] IEnumerable dtos,
- CancellationToken token = default)
+ CancellationToken token)
{
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
await gtrRepository.SaveDataAsync(telemetry.Id, dtos, token).ConfigureAwait(false);
diff --git a/AsbCloudWebApi/Controllers/SAUB/MessageController.cs b/AsbCloudWebApi/Controllers/SAUB/MessageController.cs
index 89c40692..b2bec1b8 100644
--- a/AsbCloudWebApi/Controllers/SAUB/MessageController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/MessageController.cs
@@ -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 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 GetMessagesDateRangeAsync(int idWell, CancellationToken token = default)
+ public async Task GetMessagesDateRangeAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs b/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs
index 3b88c063..a9ec26a5 100644
--- a/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/SetpointsController.cs
@@ -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 InsertAsync(int idWell, SetpointsRequestDto setpoints, CancellationToken token = default)
+ public async Task 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), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetByIdWellAsync([FromRoute] int idWell, CancellationToken token = default)
+ public async Task 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 UpdateByTelemetryUidAsync([FromRoute] string uid, int id, SetpointsRequestDto setpointsRequestDto, CancellationToken token = default)
+ public async Task 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), (int)System.Net.HttpStatusCode.OK)]
[AllowAnonymous]
- public async Task GetByTelemetryUidAsync([FromRoute] string uid, CancellationToken token = default)
+ public async Task GetByTelemetryUidAsync([FromRoute] string uid, CancellationToken token)
{
var result = await setpointsService.GetForPanelAsync(uid, token)
.ConfigureAwait(false);
@@ -151,7 +151,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
/// 1 - удалено, 0 и меньше - не удалено
[HttpDelete("api/well/{idWell}/setpoints/{id}")]
[Permission]
- public async Task TryDeleteByIdWellAsync(int idWell, int id, CancellationToken token = default)
+ public async Task TryDeleteByIdWellAsync(int idWell, int id, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
int? idUser = User.GetUserId();
diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
index b9c81731..9d0e1b8f 100644
--- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs
@@ -48,7 +48,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
[Route("{uid}")]
[AllowAnonymous]
public virtual async Task PostDataAsync(string uid, [FromBody] IEnumerable dtos,
- CancellationToken token = default)
+ CancellationToken token)
{
await telemetryDataService.UpdateDataAsync(uid, dtos, token).ConfigureAwait(false);
@@ -72,8 +72,12 @@ namespace AsbCloudWebApi.Controllers.SAUB
///
[HttpGet("{idWell}")]
[Permission]
- public virtual async Task>> GetDataAsync(int idWell, DateTime begin = default,
- int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
+ public virtual async Task>> 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> GetDataDatesRangeAsync(int idWell,
- CancellationToken token = default)
+ CancellationToken token)
{
int? idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs b/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs
index 65f503ea..44deb4d9 100644
--- a/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs
+++ b/AsbCloudWebApi/Controllers/Subsystems/SubsystemOperationTimeController.cs
@@ -43,7 +43,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
///
[HttpGet("stat")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetStatAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token = default)
+ public async Task GetStatAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token)
{
if (!await UserHasAccesToWellAsync(request.IdWell, token))
return Forbid();
@@ -62,7 +62,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
///
[HttpGet("statByActiveWell")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetStatByWellAsync(DateTime? GtDate, DateTime? LtDate, CancellationToken token = default)
+ public async Task GetStatByWellAsync(DateTime? GtDate, DateTime? LtDate, CancellationToken token)
{
var idCompany = User.GetCompanyId();
if (!idCompany.HasValue)
@@ -76,7 +76,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
///
[HttpGet("subsystem")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetSubsystemAsync([FromQuery] int? idWell, CancellationToken token = default)
+ public async Task GetSubsystemAsync([FromQuery] int? idWell, CancellationToken token)
{
if (idWell.HasValue)
if (!await UserHasAccesToWellAsync(idWell.Value, token))
@@ -90,7 +90,7 @@ namespace AsbCloudWebApi.Controllers.Subsystems
///
[HttpGet("datesRange")]
[ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetDateRangeOperationTimeAsync([FromQuery] SubsystemOperationTimeRequest request, CancellationToken token = default)
+ public async Task 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 GetOperationTimeAsync(
[FromQuery] SubsystemOperationTimeRequest request,
- CancellationToken token = default)
+ CancellationToken token)
{
if (!await UserHasAccesToWellAsync(request.IdWell, token))
return Forbid();
diff --git a/AsbCloudWebApi/Controllers/WITS/WitsControllerAbstract.cs b/AsbCloudWebApi/Controllers/WITS/WitsControllerAbstract.cs
index f2fa2c97..0e29ddd9 100644
--- a/AsbCloudWebApi/Controllers/WITS/WitsControllerAbstract.cs
+++ b/AsbCloudWebApi/Controllers/WITS/WitsControllerAbstract.cs
@@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers.WITS
string uid,
[FromBody] IEnumerable dtos,
[FromServices] IWitsRecordRepository witsRecordRepository,
- CancellationToken token = default)
+ CancellationToken token)
{
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
await witsRecordRepository.SaveDataAsync(telemetry.Id, dtos, token).ConfigureAwait(false);
diff --git a/AsbCloudWebApi/Controllers/WellCompositeController.cs b/AsbCloudWebApi/Controllers/WellCompositeController.cs
index 8c155c93..e64118fd 100644
--- a/AsbCloudWebApi/Controllers/WellCompositeController.cs
+++ b/AsbCloudWebApi/Controllers/WellCompositeController.cs
@@ -38,7 +38,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Permission]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetAsync(int idWell, CancellationToken token = default)
+ public async Task GetAsync(int idWell, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
@@ -56,7 +56,7 @@ namespace AsbCloudWebApi.Controllers
///
[HttpPost]
[Permission]
- public async Task SaveAsync(int idWell, IEnumerable wellComposites, CancellationToken token = default)
+ public async Task SaveAsync(int idWell, IEnumerable 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), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetCompositeProcessMap(int idWell, CancellationToken token = default)
+ public async Task 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 CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
+ private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token)
{
int? idCompany = User.GetCompanyId();
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
diff --git a/AsbCloudWebApi/Controllers/WellController.cs b/AsbCloudWebApi/Controllers/WellController.cs
index 627b2f88..db69f959 100644
--- a/AsbCloudWebApi/Controllers/WellController.cs
+++ b/AsbCloudWebApi/Controllers/WellController.cs
@@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Permission]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetWellsAsync(CancellationToken token = default)
+ public async Task GetWellsAsync(CancellationToken token)
{
var idCompany = User.GetCompanyId();
@@ -53,7 +53,7 @@ namespace AsbCloudWebApi.Controllers
/// Список скважин
[HttpGet("wellTree")]
[ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetWellTreeAsync(CancellationToken token = default)
+ public async Task 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 GetAsync(int idWell, CancellationToken token = default)
+ public async Task 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 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 UpdateWellStateAsync(int idWell,
[Range(0, 2, ErrorMessage = "Статус некорректен")] int idState,
- CancellationToken token = default)
+ CancellationToken token)
{
var idCompany = User.GetCompanyId();
diff --git a/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs b/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs
index 8178bed7..19952231 100644
--- a/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs
+++ b/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs
@@ -163,7 +163,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet]
[Route("wellCaseCategories")]
[Permission]
- public async Task GetWellCaseCategoriesAsync(CancellationToken token = default)
+ public async Task GetWellCaseCategoriesAsync(CancellationToken token)
{
var data = await fileCategoryService.GetWellCaseCategoriesAsync(token);
return Ok(data);