From 48343964ca0b5f6cf93cd12ea422ace3e5e07a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Fri, 28 Jul 2023 15:52:28 +0500 Subject: [PATCH 1/6] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BF=D1=83=D1=82=D0=B5=D0=B9=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AdminTelemetryController.cs | 2 +- AsbCloudWebApi/Controllers/AuthController.cs | 8 ++++---- .../Controllers/AutoGeneratedDailyReportController.cs | 2 +- AsbCloudWebApi/Controllers/DailyReportController.cs | 2 +- .../Controllers/DrillingProgramController.cs | 2 +- .../Controllers/FactTrajectoryController.cs | 1 - AsbCloudWebApi/Controllers/FaqController.cs | 2 +- .../Controllers/PlannedTrajectoryController.cs | 11 +++++------ AsbCloudWebApi/Controllers/ProcessMapController.cs | 10 +++++----- .../Controllers/SAUB/DetectedOperationController.cs | 2 +- .../Controllers/SAUB/TelemetryDataSaubController.cs | 4 +--- AsbCloudWebApi/Controllers/WellCompositeController.cs | 2 +- AsbCloudWebApi/Controllers/WellOperationController.cs | 6 +++--- 13 files changed, 25 insertions(+), 29 deletions(-) diff --git a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs index b9f30009..c0471f8e 100644 --- a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs +++ b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs @@ -29,7 +29,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpPost] - [Route("/merge/{idFrom}/{idTo}")] + [Route("/merger/{idFrom}/{idTo}")] [Permission] public async Task MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/AuthController.cs b/AsbCloudWebApi/Controllers/AuthController.cs index ca3143ba..102acc8f 100644 --- a/AsbCloudWebApi/Controllers/AuthController.cs +++ b/AsbCloudWebApi/Controllers/AuthController.cs @@ -2,7 +2,6 @@ using AsbCloudApp.Data.User; using AsbCloudApp.Repositories; using AsbCloudApp.Services; -using AsbCloudInfrastructure.Repository; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; @@ -35,7 +34,7 @@ namespace AsbCloudWebApi.Controllers /// новый токен /// логин и пароль не подходят [AllowAnonymous] - [HttpPost("login")] + [HttpPost] [SwaggerOperation(OperationId = "login")] [ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)] public async Task LoginAsync([FromBody] AuthDto auth, CancellationToken token) @@ -53,7 +52,7 @@ namespace AsbCloudWebApi.Controllers /// /// новый токен [Authorize] - [HttpGet("refresh")] + [HttpGet] [ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)] public async Task RefreshAsync(CancellationToken token) { @@ -71,6 +70,7 @@ namespace AsbCloudWebApi.Controllers /// Информация о новом пользователе /// Ок [HttpPost] + [Route("registration")] public IActionResult Register(UserRegistrationDto user) { var code = authService.Register(user); @@ -92,7 +92,7 @@ namespace AsbCloudWebApi.Controllers /// /// Ок [Authorize] - [HttpPut("{idUser}/ChangePassword")] + [HttpPut("{idUser}")] public IActionResult ChangePassword([FromRoute] int idUser, [FromBody] string newPassword) { var editorUserId = User.GetUserId(); diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs index 0ef6c6da..d19d8950 100644 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs @@ -40,7 +40,7 @@ public class AutoGeneratedDailyReportController : ControllerBase /// /// [HttpGet] - [Route("generate")] + [Route("file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GenerateAsync([FromRoute] int idWell, diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index 5abc6659..60076819 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -164,7 +164,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet("{date}/excel")] + [HttpGet("{date}/file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task DownloadAsync(int idWell, DateOnly date, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/DrillingProgramController.cs b/AsbCloudWebApi/Controllers/DrillingProgramController.cs index 69944c9d..fc4ad8ea 100644 --- a/AsbCloudWebApi/Controllers/DrillingProgramController.cs +++ b/AsbCloudWebApi/Controllers/DrillingProgramController.cs @@ -83,7 +83,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpPost("ClearError")] + [HttpDelete("errors")] [Permission("DrillingProgram.get")] public IActionResult ClearError(int idWell) { diff --git a/AsbCloudWebApi/Controllers/FactTrajectoryController.cs b/AsbCloudWebApi/Controllers/FactTrajectoryController.cs index c17ce3fd..fbdb6703 100644 --- a/AsbCloudWebApi/Controllers/FactTrajectoryController.cs +++ b/AsbCloudWebApi/Controllers/FactTrajectoryController.cs @@ -30,7 +30,6 @@ public class FactTrajectoryController : ControllerBase /// Токен отмены операции /// [HttpGet] - [Route("getRows")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetRowsAsync([FromRoute] int idWell, CancellationToken cancellationToken) diff --git a/AsbCloudWebApi/Controllers/FaqController.cs b/AsbCloudWebApi/Controllers/FaqController.cs index 763d0f6d..d0ac20c1 100644 --- a/AsbCloudWebApi/Controllers/FaqController.cs +++ b/AsbCloudWebApi/Controllers/FaqController.cs @@ -82,7 +82,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpPost("merge")] + [HttpPost("merger")] [Permission] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task MergeAsync( diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs index 5da1a2c2..bde9e732 100644 --- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs +++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs @@ -42,7 +42,7 @@ namespace AsbCloudWebApi.Controllers /// /// Запрашиваемый файл [HttpGet] - [Route("template")] + [Route("template/file")] [AllowAnonymous] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public IActionResult GetTemplate() @@ -59,7 +59,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("export")] + [Route("file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) { @@ -80,7 +80,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// количество успешно записанных строк в БД [HttpPost] - [Route("import/{deleteBeforeImport}")] + [Route("file/{deleteBeforeImport}")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, @@ -118,7 +118,6 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Список добавленных координат плановой траектории [HttpGet] - [Route("getRows")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetAsync([FromRoute] int idWell, CancellationToken token) { @@ -137,7 +136,6 @@ namespace AsbCloudWebApi.Controllers /// /// количество успешно записанных строк в БД [HttpPost] - [Route("addRow")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task AddAsync(int idWell, [FromBody] TrajectoryGeoPlanDto row, CancellationToken token) @@ -161,7 +159,7 @@ namespace AsbCloudWebApi.Controllers /// /// количество успешно записанных строк в БД [HttpPost] - [Route("addRangeRows")] + [Route("range")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task AddRangeAsync(int idWell, [FromBody] IEnumerable rows, CancellationToken token) @@ -232,6 +230,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpGet] + [Route("trajectoryCartesianPlanFact")] [ProducesResponseType(typeof(PlanFactBase, IEnumerable>), (int)System.Net.HttpStatusCode.OK)] public async Task GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index ffa88938..1e9b5e1f 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -100,7 +100,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// [HttpGet] - [Route("getReportFile/{wellId}")] + [Route("processMapReport/{wellId}/file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportFileAsync(int wellId, CancellationToken token) { @@ -127,7 +127,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpGet] - [Route("getDrillProcessMap/{wellId}")] + [Route("drillProcessMap/{wellId}")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetDrillProcessMap(int wellId, CancellationToken token) { @@ -170,7 +170,7 @@ namespace AsbCloudWebApi.Controllers /// /// Запрашиваемый файл [HttpGet] - [Route("template")] + [Route("template/file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task GetTemplateAsync(CancellationToken cancellationToken) { @@ -188,7 +188,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpPost] - [Route("import/{idWell}/{options}")] + [Route("file/{idWell}/{options}")] public async Task ImportAsync(int idWell, int options, [Required] IFormFile file, @@ -227,7 +227,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpGet] - [Route("export/{idWell}")] + [Route("file/{idWell}")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task ExportAsync(int idWell, CancellationToken cancellationToken) { diff --git a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs index 02737317..3e1c4da2 100644 --- a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs @@ -121,7 +121,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("export")] + [Route("file")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task ExportAsync(int? idWell, int? idCluster, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs index 8158308e..7baf98a6 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs @@ -3,10 +3,8 @@ using AsbCloudApp.Services; using AsbCloudWebApi.SignalR; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; -using System.IO; using System.Threading.Tasks; using System.Threading; -using AsbCloudInfrastructure.Services; using System; namespace AsbCloudWebApi.Controllers.SAUB @@ -43,7 +41,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// конец интервала в формате: yyyy-MM-DD HH:mm /// /// - [HttpGet("{idWell}/export/csv")] + [HttpGet("{idWell}/file")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task GetZippedCsv(int idWell, DateTime beginDate, DateTime endDate, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/WellCompositeController.cs b/AsbCloudWebApi/Controllers/WellCompositeController.cs index e64118fd..d977128d 100644 --- a/AsbCloudWebApi/Controllers/WellCompositeController.cs +++ b/AsbCloudWebApi/Controllers/WellCompositeController.cs @@ -71,7 +71,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet("getCompositeProcessMap")] + [HttpGet("compositeProcessMap")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetCompositeProcessMap(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 7bac5579..b2bd75a2 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -284,7 +284,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Permission] - [Route("import/{options}")] + [Route("file/{options}")] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, int options, @@ -327,7 +327,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("export")] + [Route("file")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) @@ -378,7 +378,7 @@ namespace AsbCloudWebApi.Controllers /// /// Запрашиваемый файл [HttpGet] - [Route("template")] + [Route("template/file")] [AllowAnonymous] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public IActionResult GetTemplate() From a0ef71a43d22424581bc5bdc03bbee26c0a8995c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 1 Aug 2023 11:17:46 +0500 Subject: [PATCH 2/6] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BF=D1=83=D1=82=D0=B8=20=D1=83=20=D0=BC=D0=B5=D1=82=D0=BE?= =?UTF-8?q?=D0=B4=D0=BE=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE=D0=BB?= =?UTF-8?q?=D0=BB=D0=B5=D1=80=D0=BE=D0=B2=20+=20=D0=BC=D0=B5=D0=BB=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoGeneratedDailyReportController.cs | 8 ++--- .../Controllers/DailyReportController.cs | 23 ++++++------- .../PlannedTrajectoryController.cs | 18 ++++++----- .../Controllers/ProcessMapController.cs | 32 +++++++++---------- .../SAUB/DetectedOperationController.cs | 8 +++-- .../SAUB/TelemetryDataSaubController.cs | 8 +++-- .../Controllers/WellOperationController.cs | 19 ++++++----- 7 files changed, 59 insertions(+), 57 deletions(-) diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs index d19d8950..bc496b1e 100644 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs @@ -40,10 +40,10 @@ public class AutoGeneratedDailyReportController : ControllerBase /// /// [HttpGet] - [Route("file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK)] + [Route("export/excel")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GenerateAsync([FromRoute] int idWell, + public async Task ExportAsync([FromRoute] int idWell, [Required] DateOnly reportDate, CancellationToken cancellationToken) { @@ -54,7 +54,7 @@ public class AutoGeneratedDailyReportController : ControllerBase reportDate, cancellationToken); - return File(reportFile.stream, "application/octet-stream", reportFile.fileName); + return File(reportFile.stream, reportFile.fileName); } /// diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index 60076819..fa8f750f 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -1,7 +1,6 @@ using AsbCloudApp.Data; using AsbCloudApp.Data.DailyReport; using AsbCloudApp.Exceptions; -using AsbCloudApp.Repositories; using AsbCloudApp.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -10,6 +9,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; namespace AsbCloudWebApi.Controllers { @@ -24,16 +24,13 @@ namespace AsbCloudWebApi.Controllers { private readonly IDailyReportService dailyReportService; private readonly IWellService wellService; - private readonly IWellOperationRepository operationRepository; public DailyReportController( IDailyReportService dailyReportService, - IWellService wellService, - IWellOperationRepository operationRepository) + IWellService wellService) { this.dailyReportService = dailyReportService; this.wellService = wellService; - this.operationRepository = operationRepository; } /// @@ -164,8 +161,9 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet("{date}/file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [HttpGet("{date}/export/excel")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task DownloadAsync(int idWell, DateOnly date, CancellationToken token) { if (!await UserHasAccesToWellAsync(idWell, token)) @@ -175,13 +173,12 @@ namespace AsbCloudWebApi.Controllers ?? throw new ArgumentInvalidException($"Скважина c id:{idWell} не найдена", nameof(idWell)); var stream = await dailyReportService.MakeReportAsync(idWell, date, token); - if (stream is not null) - { - var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx"; - return File(stream, "application/octet-stream", fileName); - } - else + if (stream is null) return NoContent(); + + var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx"; + return File(stream, fileName); + } protected async Task UserHasAccesToWellAsync(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs index bde9e732..dcad7eac 100644 --- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs +++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs @@ -38,18 +38,19 @@ namespace AsbCloudWebApi.Controllers } /// - /// Возвращает шаблон для заполнения строк плановой траектории + /// Возвращает excel шаблон для заполнения строк плановой траектории /// /// Запрашиваемый файл [HttpGet] - [Route("template/file")] + [Route("template/excel")] [AllowAnonymous] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK,"application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public IActionResult GetTemplate() { var stream = plannedTrajectoryImportService.GetTemplateFile(); var fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } /// @@ -59,8 +60,9 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [Route("export/excel")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, @@ -68,7 +70,7 @@ namespace AsbCloudWebApi.Controllers return Forbid(); var stream = await plannedTrajectoryImportService.ExportAsync(idWell, token); var fileName = await plannedTrajectoryImportService.GetFileNameAsync(idWell, token); - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } /// @@ -80,7 +82,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// количество успешно записанных строк в БД [HttpPost] - [Route("file/{deleteBeforeImport}")] + [Route("import/excel/{deleteBeforeImport}")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 1e9b5e1f..fa803d18 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -100,8 +100,9 @@ namespace AsbCloudWebApi.Controllers /// /// /// [HttpGet] - [Route("processMapReport/{wellId}/file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [Route("processMapReport/export/excel/{wellId}")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GetReportFileAsync(int wellId, CancellationToken token) { var stream = await processMapReportService.MakeReportAsync(wellId, token); @@ -110,14 +111,12 @@ namespace AsbCloudWebApi.Controllers var well = await wellService.GetOrDefaultAsync(wellId, token); if (well is null) return NoContent(); - else - { - var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx"; - return File(stream, "application/octet-stream", fileName); - } + + var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx"; + return File(stream, fileName); } - else - return NoContent(); + + return NoContent(); } /// @@ -170,13 +169,13 @@ namespace AsbCloudWebApi.Controllers /// /// Запрашиваемый файл [HttpGet] - [Route("template/file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [Route("template/excel")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] public async Task GetTemplateAsync(CancellationToken cancellationToken) { var stream = await processMapPlanImportService.GetExcelTemplateStreamAsync(cancellationToken); var fileName = "ЕЦП_шаблон_файла_РТК.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } /// @@ -188,7 +187,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpPost] - [Route("file/{idWell}/{options}")] + [Route("import/excel/{idWell}/{options}")] public async Task ImportAsync(int idWell, int options, [Required] IFormFile file, @@ -227,8 +226,9 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpGet] - [Route("file/{idWell}")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [Route("export/excel/{idWell}")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync(int idWell, CancellationToken cancellationToken) { int? idUser = User.GetUserId(); @@ -243,7 +243,7 @@ namespace AsbCloudWebApi.Controllers var stream = await processMapPlanImportService.ExportAsync(idWell, cancellationToken); var fileName = $"РТК-план по скважине {well.Caption} куст {well.Cluster}.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } private async Task NotifyUsersBySignalR(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs index 3e1c4da2..c30b6f6b 100644 --- a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; namespace AsbCloudWebApi.Controllers.SAUB { @@ -121,9 +122,10 @@ namespace AsbCloudWebApi.Controllers.SAUB /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("file")] + [Route("export/excel")] [Permission] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync(int? idWell, int? idCluster, CancellationToken token) { if (idCluster is null && idWell is null) @@ -151,7 +153,7 @@ namespace AsbCloudWebApi.Controllers.SAUB var stream = await detectedOperationService.ExportAsync(idsWells, token); var fileName = "operations.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } } } diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs index 7baf98a6..5cf3fce0 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataSaubController.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.SignalR; using System.Threading.Tasks; using System.Threading; using System; +using Microsoft.AspNetCore.Http; namespace AsbCloudWebApi.Controllers.SAUB { @@ -41,8 +42,9 @@ namespace AsbCloudWebApi.Controllers.SAUB /// конец интервала в формате: yyyy-MM-DD HH:mm /// /// - [HttpGet("{idWell}/file")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [HttpGet("{idWell}/export/csv")] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GetZippedCsv(int idWell, DateTime beginDate, DateTime endDate, CancellationToken token) { int? idCompany = User.GetCompanyId(); @@ -58,7 +60,7 @@ namespace AsbCloudWebApi.Controllers.SAUB var stream = await telemetryDataSaubService.GetZippedCsv(idWell, beginDate, endDate, token).ConfigureAwait(false); var fileName = $"DataSaub idWell{idWell} {beginDate:yyyy-MM-DDTHH-mm} - {endDate:yyyy-MM-DDTHH-mm}.zip"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } } } diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index b2bd75a2..639a5c5f 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -1,5 +1,4 @@ using AsbCloudApp.Data; -using AsbCloudApp.Exceptions; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; @@ -10,7 +9,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -284,7 +282,7 @@ namespace AsbCloudWebApi.Controllers /// [HttpPost] [Permission] - [Route("file/{options}")] + [Route("import/excel/{options}")] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, int options, @@ -324,12 +322,13 @@ namespace AsbCloudWebApi.Controllers /// Создает excel файл с операциями по скважине /// /// id скважины - /// Токен отмены задачи + /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("file")] + [Route("export/excel")] [Permission] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) { int? idCompany = User.GetCompanyId(); @@ -343,7 +342,7 @@ namespace AsbCloudWebApi.Controllers var stream = wellOperationImportService.Export(idWell); var fileName = await wellService.GetWellCaptionByIdAsync(idWell, token) + "_operations.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } /// @@ -378,14 +377,14 @@ namespace AsbCloudWebApi.Controllers /// /// Запрашиваемый файл [HttpGet] - [Route("template/file")] + [Route("template/excel")] [AllowAnonymous] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] + [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] public IActionResult GetTemplate() { var stream = wellOperationImportService.GetExcelTemplateStream(); var fileName = "ЕЦП_шаблон_файла_операций.xlsx"; - return File(stream, "application/octet-stream", fileName); + return File(stream, fileName); } private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token) From e059221e323068ab249aa927fc8b16e0916a9647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 7 Aug 2023 09:29:31 +0500 Subject: [PATCH 3/6] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Controllers/AuthController.cs | 7 +++---- .../Controllers/AutoGeneratedDailyReportController.cs | 1 - AsbCloudWebApi/Controllers/DailyReportController.cs | 2 +- AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs | 2 +- AsbCloudWebApi/Controllers/ProcessMapController.cs | 2 +- .../Controllers/SAUB/DetectedOperationController.cs | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/AsbCloudWebApi/Controllers/AuthController.cs b/AsbCloudWebApi/Controllers/AuthController.cs index 102acc8f..a041b2a5 100644 --- a/AsbCloudWebApi/Controllers/AuthController.cs +++ b/AsbCloudWebApi/Controllers/AuthController.cs @@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Controllers /// новый токен /// логин и пароль не подходят [AllowAnonymous] - [HttpPost] + [HttpPost("login")] [SwaggerOperation(OperationId = "login")] [ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)] public async Task LoginAsync([FromBody] AuthDto auth, CancellationToken token) @@ -52,7 +52,7 @@ namespace AsbCloudWebApi.Controllers /// /// новый токен [Authorize] - [HttpGet] + [HttpGet("refresh")] [ProducesResponseType(typeof(UserTokenDto), (int)System.Net.HttpStatusCode.OK)] public async Task RefreshAsync(CancellationToken token) { @@ -70,7 +70,6 @@ namespace AsbCloudWebApi.Controllers /// Информация о новом пользователе /// Ок [HttpPost] - [Route("registration")] public IActionResult Register(UserRegistrationDto user) { var code = authService.Register(user); @@ -92,7 +91,7 @@ namespace AsbCloudWebApi.Controllers /// /// Ок [Authorize] - [HttpPut("{idUser}")] + [HttpPut("{idUser}/ChangePassword")] public IActionResult ChangePassword([FromRoute] int idUser, [FromBody] string newPassword) { var editorUserId = User.GetUserId(); diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs index bc496b1e..fd2ef549 100644 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs @@ -40,7 +40,6 @@ public class AutoGeneratedDailyReportController : ControllerBase /// /// [HttpGet] - [Route("export/excel")] [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync([FromRoute] int idWell, diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index fa8f750f..707421dd 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -161,7 +161,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet("{date}/export/excel")] + [HttpGet("{date}/excel")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task DownloadAsync(int idWell, DateOnly date, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs index dcad7eac..6b116ae3 100644 --- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs +++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs @@ -60,7 +60,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("export/excel")] + [Route("export")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index fa803d18..97abcf11 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -100,7 +100,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// [HttpGet] - [Route("processMapReport/export/excel/{wellId}")] + [Route("processMapReport/excel/{wellId}")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GetReportFileAsync(int wellId, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs index c30b6f6b..e2bf92eb 100644 --- a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs @@ -122,7 +122,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// Токен отмены задачи /// Запрашиваемый файл [HttpGet] - [Route("export/excel")] + [Route("export")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] From eec40bf4b75ea3931a46f300bb4ad75d46fec9f9 Mon Sep 17 00:00:00 2001 From: Frolov-Nikita Date: Tue, 8 Aug 2023 12:21:09 +0500 Subject: [PATCH 4/6] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20Rout?= =?UTF-8?q?e=20=D0=B0=D1=82=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82=20=D1=83?= =?UTF-8?q?=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=BE=D0=B2.?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AdminTelemetryController.cs | 3 +- .../AutoGeneratedDailyReportController.cs | 4 +-- AsbCloudWebApi/Controllers/FaqController.cs | 2 +- AsbCloudWebApi/Controllers/FileController.cs | 9 ++--- .../Controllers/HelpPageController.cs | 3 +- .../Controllers/MeasureController.cs | 12 +++---- .../Controllers/NotificationController.cs | 9 ++--- .../Controllers/OperationStatController.cs | 12 +++---- .../Controllers/OperationValueController.cs | 2 +- .../PlannedTrajectoryController.cs | 15 +++------ .../Controllers/ProcessMapController.cs | 21 ++++-------- .../Controllers/ReportController.cs | 6 ++-- .../SAUB/DetectedOperationController.cs | 3 +- .../Controllers/SAUB/MessageController.cs | 3 +- .../Controllers/SAUB/TelemetryController.cs | 12 +++---- .../SAUB/TelemetryDataBaseController.cs | 6 ++-- .../SAUB/TelemetryWirelineRunOutController.cs | 3 +- .../WellFinalDocumentsController.cs | 3 +- .../Controllers/WellOperationController.cs | 33 +++++++------------ 19 files changed, 54 insertions(+), 107 deletions(-) diff --git a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs index c0471f8e..4fb1f9fb 100644 --- a/AsbCloudWebApi/Controllers/AdminTelemetryController.cs +++ b/AsbCloudWebApi/Controllers/AdminTelemetryController.cs @@ -28,8 +28,7 @@ namespace AsbCloudWebApi.Controllers /// Merge telemetries. No body required. /// /// - [HttpPost] - [Route("/merger/{idFrom}/{idTo}")] + [HttpPost("/merge/{idFrom}/{idTo}")] [Permission] public async Task MergeTelemetriesAsync(int idFrom, int idTo, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs index fd2ef549..df94b605 100644 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs @@ -42,7 +42,7 @@ public class AutoGeneratedDailyReportController : ControllerBase [HttpGet] [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task ExportAsync([FromRoute] int idWell, + public async Task GenerateReportAsync([FromRoute] int idWell, [Required] DateOnly reportDate, CancellationToken cancellationToken) { @@ -63,7 +63,7 @@ public class AutoGeneratedDailyReportController : ControllerBase /// Параметры запроса /// /// - [HttpGet] + [HttpGet("all")] [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] public async Task GetListAsync([FromRoute][Required] int idWell, [FromQuery] AutoGeneratedDailyReportRequest request, diff --git a/AsbCloudWebApi/Controllers/FaqController.cs b/AsbCloudWebApi/Controllers/FaqController.cs index d0ac20c1..763d0f6d 100644 --- a/AsbCloudWebApi/Controllers/FaqController.cs +++ b/AsbCloudWebApi/Controllers/FaqController.cs @@ -82,7 +82,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpPost("merger")] + [HttpPost("merge")] [Permission] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task MergeAsync( diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs index 2a7d6fcb..e9a7990b 100644 --- a/AsbCloudWebApi/Controllers/FileController.cs +++ b/AsbCloudWebApi/Controllers/FileController.cs @@ -73,8 +73,7 @@ namespace AsbCloudWebApi.Controllers /// /// Токен отмены задачи /// Список информации о файлах в этой категории - [HttpGet] - [Route("/api/files")] + [HttpGet("/api/files")] [Permission] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] public async Task GetFilesInfoAsync( @@ -101,8 +100,7 @@ namespace AsbCloudWebApi.Controllers /// id запрашиваемого файла /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("{idFile}")] + [HttpGet("{idFile}")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task GetFileAsync( @@ -220,8 +218,7 @@ namespace AsbCloudWebApi.Controllers /// id запрашиваемого файла /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("/api/files/{idFile}")] + [HttpGet("/api/files/{idFile}")] [Permission] [ProducesResponseType(typeof(FileInfoDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetFileInfoAsync([FromRoute] int idFile, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/HelpPageController.cs b/AsbCloudWebApi/Controllers/HelpPageController.cs index db0b5faf..a90ea46a 100644 --- a/AsbCloudWebApi/Controllers/HelpPageController.cs +++ b/AsbCloudWebApi/Controllers/HelpPageController.cs @@ -102,8 +102,7 @@ public class HelpPageController : ControllerBase /// Id категории файла. Допустимое значение параметра: 20000 /// /// - [HttpGet] - [Route("isExisting")] + [HttpGet("isExisting")] [ProducesResponseType(typeof(bool), (int)HttpStatusCode.OK)] public async Task IsExistingAsync( [Required] string key, diff --git a/AsbCloudWebApi/Controllers/MeasureController.cs b/AsbCloudWebApi/Controllers/MeasureController.cs index 510a34ca..7dc1afde 100644 --- a/AsbCloudWebApi/Controllers/MeasureController.cs +++ b/AsbCloudWebApi/Controllers/MeasureController.cs @@ -24,9 +24,8 @@ namespace AsbCloudWebApi.Controllers this.wellService = wellService; } - [HttpGet] + [HttpGet("categories")] [Permission] - [Route("categories")] public async Task GetCategoriesAsync([FromRoute] int idWell, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) @@ -36,9 +35,8 @@ namespace AsbCloudWebApi.Controllers return Ok(result); } - [HttpGet] + [HttpGet("last/{idCategory}")] [Permission] - [Route("last/{idCategory}")] public async Task GetLastAsync([FromRoute] int idWell, [FromRoute] int idCategory, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) @@ -55,9 +53,8 @@ namespace AsbCloudWebApi.Controllers /// Категория скважины. Не обязательный параметр. /// /// - [HttpGet] + [HttpGet("history")] [Permission] - [Route("history")] public async Task GetHisoryAsync([FromRoute] int idWell, CancellationToken token, int? idCategory = null) { @@ -90,9 +87,8 @@ namespace AsbCloudWebApi.Controllers return Ok(result); } - [HttpDelete] + [HttpDelete("history/{idData}")] [Permission] - [Route("history/{idData}")] public async Task MarkAsDeleteAsync([FromRoute] int idWell, [FromRoute] int idData, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) diff --git a/AsbCloudWebApi/Controllers/NotificationController.cs b/AsbCloudWebApi/Controllers/NotificationController.cs index 2e1bb976..ebb738e4 100644 --- a/AsbCloudWebApi/Controllers/NotificationController.cs +++ b/AsbCloudWebApi/Controllers/NotificationController.cs @@ -16,7 +16,7 @@ namespace AsbCloudWebApi.Controllers; /// [ApiController] [Authorize] -[Route("api/notification")] +[Route("api/[controller]")] public class NotificationController : ControllerBase { private readonly NotificationService notificationService; @@ -40,7 +40,6 @@ public class NotificationController : ControllerBase /// /// [HttpPost] - [Route("send")] public async Task SendAsync([Required] int idUser, [Required] [Range(minimum: 1, maximum: 1, ErrorMessage = "Id категории уведомления недоступно. Допустимые: 1")] @@ -70,7 +69,6 @@ public class NotificationController : ControllerBase /// /// [HttpPut] - [Route("update")] public async Task UpdateAsync([Required] int idNotification, [Required] bool isRead, CancellationToken cancellationToken) @@ -88,8 +86,7 @@ public class NotificationController : ControllerBase /// Id уведомления /// /// - [HttpGet] - [Route("get/{idNotification}")] + [HttpGet("{idNotification}")] [ProducesResponseType(typeof(NotificationDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetAsync([Required] int idNotification, CancellationToken cancellationToken) @@ -112,7 +109,6 @@ public class NotificationController : ControllerBase /// /// [HttpGet] - [Route("getList")] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] public async Task GetListAsync([FromQuery] NotificationRequest request, CancellationToken cancellationToken) @@ -136,7 +132,6 @@ public class NotificationController : ControllerBase /// /// [HttpDelete] - [Route("delete")] public async Task DeleteAsync([Required] int idNotification, CancellationToken cancellationToken) { diff --git a/AsbCloudWebApi/Controllers/OperationStatController.cs b/AsbCloudWebApi/Controllers/OperationStatController.cs index 9fa4f5bd..d4346255 100644 --- a/AsbCloudWebApi/Controllers/OperationStatController.cs +++ b/AsbCloudWebApi/Controllers/OperationStatController.cs @@ -77,8 +77,7 @@ namespace AsbCloudWebApi.Controllers /// id куста /// /// - [HttpGet] - [Route("cluster/{idCluster}/stat")] + [HttpGet("cluster/{idCluster}/stat")] [Permission] [ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetStatClusterAsync(int idCluster, @@ -99,8 +98,7 @@ namespace AsbCloudWebApi.Controllers /// список скважин /// /// - [HttpGet] - [Route("wellsStats")] + [HttpGet("wellsStats")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetWellsStatAsync([FromQuery] IEnumerable idWells, CancellationToken token) @@ -123,8 +121,7 @@ namespace AsbCloudWebApi.Controllers /// id скважины /// /// - [HttpGet] - [Route("well/{idWell}/stat")] + [HttpGet("well/{idWell}/stat")] [Permission] [ProducesResponseType(typeof(StatWellDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetStatWellAsync(int idWell, @@ -144,8 +141,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet] - [Route("well/{idWell}/tvd")] + [HttpGet("well/{idWell}/tvd")] [Permission] [ProducesResponseType(typeof(IEnumerable>), (int)System.Net.HttpStatusCode.OK)] public async Task GetTvdAsync(int idWell, diff --git a/AsbCloudWebApi/Controllers/OperationValueController.cs b/AsbCloudWebApi/Controllers/OperationValueController.cs index 6e9c312b..5a58953b 100644 --- a/AsbCloudWebApi/Controllers/OperationValueController.cs +++ b/AsbCloudWebApi/Controllers/OperationValueController.cs @@ -8,7 +8,7 @@ namespace AsbCloudWebApi.Controllers /// /// Целевые и нормативные значения по глубине /// - [Route("api/operationValue")] + [Route("api/[controller]")] [ApiController] [Authorize] public class OperationValueController : CrudWellRelatedController> diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs index 6b116ae3..322dc454 100644 --- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs +++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs @@ -41,8 +41,7 @@ namespace AsbCloudWebApi.Controllers /// Возвращает excel шаблон для заполнения строк плановой траектории /// /// Запрашиваемый файл - [HttpGet] - [Route("template/excel")] + [HttpGet("template")] [AllowAnonymous] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK,"application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -59,8 +58,7 @@ namespace AsbCloudWebApi.Controllers /// id скважины /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("export")] + [HttpGet("export")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync([FromRoute] int idWell, CancellationToken token) @@ -81,8 +79,7 @@ namespace AsbCloudWebApi.Controllers /// Удалить операции перед импортом, если фал валидный /// Токен отмены задачи /// количество успешно записанных строк в БД - [HttpPost] - [Route("import/excel/{deleteBeforeImport}")] + [HttpPost("import/{deleteBeforeImport}")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, @@ -160,8 +157,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// количество успешно записанных строк в БД - [HttpPost] - [Route("range")] + [HttpPost("range")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task AddRangeAsync(int idWell, [FromBody] IEnumerable rows, CancellationToken token) @@ -231,8 +227,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet] - [Route("trajectoryCartesianPlanFact")] + [HttpGet("trajectoryCartesianPlanFact")] [ProducesResponseType(typeof(PlanFactBase, IEnumerable>), (int)System.Net.HttpStatusCode.OK)] public async Task GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 97abcf11..0199cb9a 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -57,9 +57,8 @@ namespace AsbCloudWebApi.Controllers /// Дата, с которой следует искать новые параметры /// Токен отмены задачи /// Список параметров для коридоров бурения - [HttpGet] + [HttpGet("/api/telemetry/{uid}/drillFlowChart")] [Obsolete("use GetByUidAsync(..) instead")] - [Route("/api/telemetry/{uid}/drillFlowChart")] [AllowAnonymous] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public IActionResult GetByTelemetry(string uid, DateTime updateFrom, CancellationToken token) @@ -77,8 +76,7 @@ namespace AsbCloudWebApi.Controllers /// Дата, с которой следует искать новые параметры /// Токен отмены задачи /// Список параметров для коридоров бурения - [HttpGet] - [Route("/api/telemetry/{uid}/processMap")] + [HttpGet("/api/telemetry/{uid}/processMap")] [AllowAnonymous] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetByUidAsync(string uid, DateTime updateFrom, CancellationToken token) @@ -99,8 +97,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// /// - [HttpGet] - [Route("processMapReport/excel/{wellId}")] + [HttpGet("report/{wellId}")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task GetReportFileAsync(int wellId, CancellationToken token) @@ -125,8 +122,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet] - [Route("drillProcessMap/{wellId}")] + [HttpGet("report/{wellId}/data")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetDrillProcessMap(int wellId, CancellationToken token) { @@ -168,8 +164,7 @@ namespace AsbCloudWebApi.Controllers /// Возвращает шаблон файла импорта плановой РТК /// /// Запрашиваемый файл - [HttpGet] - [Route("template/excel")] + [HttpGet("template")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] public async Task GetTemplateAsync(CancellationToken cancellationToken) { @@ -186,8 +181,7 @@ namespace AsbCloudWebApi.Controllers /// Загружаемый файл /// /// - [HttpPost] - [Route("import/excel/{idWell}/{options}")] + [HttpPost("import/{idWell}/{options}")] public async Task ImportAsync(int idWell, int options, [Required] IFormFile file, @@ -225,8 +219,7 @@ namespace AsbCloudWebApi.Controllers /// Id скважины /// /// - [HttpGet] - [Route("export/excel/{idWell}")] + [HttpGet("export/{idWell}")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task ExportAsync(int idWell, CancellationToken cancellationToken) diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs index c20db17b..3386d505 100644 --- a/AsbCloudWebApi/Controllers/ReportController.cs +++ b/AsbCloudWebApi/Controllers/ReportController.cs @@ -104,8 +104,7 @@ namespace AsbCloudWebApi.Controllers /// Параметры запроса /// Токен для отмены задачи /// прогнозируемое кол-во страниц отчета - [HttpGet] - [Route("reportSize")] + [HttpGet("reportSize")] [Permission] [ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportSizeAsync([Required] int idWell, @@ -133,8 +132,7 @@ namespace AsbCloudWebApi.Controllers /// id скважины /// Токен для отмены задачи /// Даты самого старого и самого свежего отчетов в БД - [HttpGet] - [Route("datesRange")] + [HttpGet("datesRange")] [Permission] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportsDateRangeAsync(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs index e2bf92eb..0a16bcfd 100644 --- a/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/DetectedOperationController.cs @@ -121,8 +121,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("export")] + [HttpGet("export")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] diff --git a/AsbCloudWebApi/Controllers/SAUB/MessageController.cs b/AsbCloudWebApi/Controllers/SAUB/MessageController.cs index b2bec1b8..cdac923d 100644 --- a/AsbCloudWebApi/Controllers/SAUB/MessageController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/MessageController.cs @@ -64,8 +64,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// id скважины /// Токен для отмены задачи /// список сообщений по скважине - [HttpGet] - [Route("datesRange")] + [HttpGet("datesRange")] [Permission] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetMessagesDateRangeAsync(int idWell, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryController.cs index f7fe0b74..a70cc72f 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryController.cs @@ -44,8 +44,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// Информация об отправителе /// Токен отмены задачи /// - [HttpPost] - [Route("{uid}/info")] + [HttpPost("{uid}/info")] public async Task PostInfoAsync(string uid, [FromBody] TelemetryInfoDto info, CancellationToken token) { @@ -60,8 +59,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// сообщения /// Токен для отмены задачи /// - [HttpPost] - [Route("{uid}/message")] + [HttpPost("{uid}/message")] public async Task PostMessagesAsync(string uid, [FromBody] IEnumerable dtos, CancellationToken token) { @@ -82,8 +80,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// справочник событий /// Токен для отмены задачи /// - [HttpPost] - [Route("{uid}/event")] + [HttpPost("{uid}/event")] public async Task PostEventsAsync(string uid, [FromBody] List events, CancellationToken token) { @@ -99,8 +96,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// справочник пользователей телеметрии /// /// - [HttpPost] - [Route("{uid}/user")] + [HttpPost("{uid}/user")] public async Task PostUsersAsync(string uid, [FromBody] List users, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs index 8eb26d56..05af2b9a 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs @@ -44,8 +44,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// Данные /// Токен для отмены задачи /// - [HttpPost] - [Route("{uid}")] + [HttpPost("{uid}")] [AllowAnonymous] public virtual async Task PostDataAsync(string uid, [FromBody] IEnumerable dtos, CancellationToken token) @@ -102,8 +101,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// id скважины /// Токен завершения задачи /// - [HttpGet] - [Route("{idWell}/datesRange")] + [HttpGet("{idWell}/datesRange")] [Permission] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public virtual async Task> GetDataDatesRangeAsync(int idWell, diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryWirelineRunOutController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryWirelineRunOutController.cs index a9ee2815..b936edd5 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryWirelineRunOutController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryWirelineRunOutController.cs @@ -45,8 +45,7 @@ namespace AsbCloudWebApi.Controllers.SAUB /// /// /// - [HttpPost] - [Route("{uid}")] + [HttpPost("{uid}")] [AllowAnonymous] public async Task PostDataAsync(string uid, [FromBody] TelemetryWirelineRunOutBaseDto dto, CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs b/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs index 19952231..3cd7156b 100644 --- a/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs +++ b/AsbCloudWebApi/Controllers/WellFinalDocumentsController.cs @@ -160,8 +160,7 @@ namespace AsbCloudWebApi.Controllers /// Получение справочника категорий файлов /// /// - [HttpGet] - [Route("wellCaseCategories")] + [HttpGet("wellCaseCategories")] [Permission] public async Task GetWellCaseCategoriesAsync(CancellationToken token) { diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 639a5c5f..4bb40bdc 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -38,8 +38,7 @@ namespace AsbCloudWebApi.Controllers /// Возвращает словарь типов секций /// /// - [HttpGet] - [Route("sectionTypes")] + [HttpGet("sectionTypes")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public IActionResult GetSectionTypes() @@ -53,8 +52,7 @@ namespace AsbCloudWebApi.Controllers /// /// флаг, нужно ли включать родителей в список /// - [HttpGet] - [Route("categories")] + [HttpGet("categories")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public IActionResult GetCategories(bool includeParents = true) @@ -70,8 +68,7 @@ namespace AsbCloudWebApi.Controllers /// дата для нахождения последней сопоставленной плановой операции /// /// - [HttpGet] - [Route("operationsPlan")] + [HttpGet("operationsPlan")] [ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetOperationsPlanAsync( [FromRoute] int idWell, @@ -95,8 +92,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// Список операций на скважине - [HttpGet] - [Route("fact")] + [HttpGet("fact")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetPageOperationsFactAsync( @@ -123,8 +119,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// Список операций на скважине в контейнере для постраничного просмотра - [HttpGet] - [Route("plan")] + [HttpGet("plan")] [Permission] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] public async Task GetPageOperationsPlanAsync( @@ -150,8 +145,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpGet] - [Route("groupStat")] + [HttpGet("groupStat")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetGroupOperationsAsync( @@ -177,8 +171,7 @@ namespace AsbCloudWebApi.Controllers /// id нужной операции /// Токен отмены задачи /// Нужную операцию на скважине - [HttpGet] - [Route("{idOperation}")] + [HttpGet("{idOperation}")] [Permission] [ProducesResponseType(typeof(WellOperationDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetOrDefaultAsync(int idWell, int idOperation, @@ -280,9 +273,8 @@ namespace AsbCloudWebApi.Controllers /// Удалить операции перед импортом = 1, если фал валидный /// Токен отмены задачи /// - [HttpPost] + [HttpPost("import/{options}")] [Permission] - [Route("import/excel/{options}")] public async Task ImportAsync(int idWell, [FromForm] IFormFileCollection files, int options, @@ -324,8 +316,7 @@ namespace AsbCloudWebApi.Controllers /// id скважины /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("export/excel")] + [HttpGet("export")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -352,8 +343,7 @@ namespace AsbCloudWebApi.Controllers /// /// Токен отмены задачи /// Запрашиваемый файл - [HttpGet] - [Route("scheduleReport")] + [HttpGet("scheduleReport")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task ScheduleReportAsync([FromRoute] int idWell, [FromServices] IScheduleReportService scheduleReportService, CancellationToken token) @@ -376,8 +366,7 @@ namespace AsbCloudWebApi.Controllers /// Возвращает шаблон файла импорта /// /// Запрашиваемый файл - [HttpGet] - [Route("template/excel")] + [HttpGet("template")] [AllowAnonymous] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")] public IActionResult GetTemplate() From 286154692eb3cf731a8ff6f6ab516d305ee50736 Mon Sep 17 00:00:00 2001 From: Frolov-Nikita Date: Tue, 8 Aug 2023 12:24:44 +0500 Subject: [PATCH 5/6] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B9=20=D0=BA=D0=BE=D1=81=D1=82=D1=8B=D0=BB=D1=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Services/IWellService.cs | 7 ------- .../Services/WellService.cs | 20 ------------------- AsbCloudInfrastructure/Startup.cs | 4 +--- .../Controllers/AdminWellController.cs | 8 -------- 4 files changed, 1 insertion(+), 38 deletions(-) diff --git a/AsbCloudApp/Services/IWellService.cs b/AsbCloudApp/Services/IWellService.cs index a1df94f3..edea98ae 100644 --- a/AsbCloudApp/Services/IWellService.cs +++ b/AsbCloudApp/Services/IWellService.cs @@ -97,13 +97,6 @@ namespace AsbCloudApp.Services /// DatesRangeDto GetDatesRange(int idWell); - /// - /// Проверить задан ли у скважины часовой пояс и задать его если он не задан - /// - /// - /// - Task EnshureTimezonesIsSetAsync(CancellationToken token); - /// /// ВРЕМЕННЫЙ метод /// diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index 4cf88d82..c47dd204 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -300,26 +300,6 @@ namespace AsbCloudInfrastructure.Services return dto; } - public async Task EnshureTimezonesIsSetAsync(CancellationToken token) - { - var cache = await GetCacheAsync(token); - if (!cache.Any(w => w.Timezone is null)) - return; - - var defaultTimeZone = new SimpleTimezone - { - Hours = 5, - IsOverride = false, - TimezoneId = "Assumed", - }; - - await dbSet.Where(w => w.Timezone == null) - .ForEachAsync(w => w.Timezone = defaultTimeZone, token); - - await dbContext.SaveChangesAsync(token); - DropCache(); - } - public SimpleTimezoneDto GetTimezone(int idWell) { var well = GetOrDefault(idWell); diff --git a/AsbCloudInfrastructure/Startup.cs b/AsbCloudInfrastructure/Startup.cs index 207270c2..5cd670fd 100644 --- a/AsbCloudInfrastructure/Startup.cs +++ b/AsbCloudInfrastructure/Startup.cs @@ -27,9 +27,7 @@ namespace AsbCloudInfrastructure context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60)); context.Database.Migrate(); - var wellService = provider.GetRequiredService(); - wellService.EnshureTimezonesIsSetAsync(CancellationToken.None).Wait();// TODO: make this background work - + // TODO: Сделать инициализацию кеша телеметрии более явной. _ = provider.GetRequiredService>(); _ = provider.GetRequiredService>(); diff --git a/AsbCloudWebApi/Controllers/AdminWellController.cs b/AsbCloudWebApi/Controllers/AdminWellController.cs index 4a670652..ac08b383 100644 --- a/AsbCloudWebApi/Controllers/AdminWellController.cs +++ b/AsbCloudWebApi/Controllers/AdminWellController.cs @@ -18,13 +18,5 @@ namespace AsbCloudWebApi.Controllers public AdminWellController(IWellService service) : base(service) { } - - [HttpPost("EnshureTimezonesIsSet")] - [Permission] - public async Task EnshureTimezonesIsSet(CancellationToken token) - { - await ((IWellService)service).EnshureTimezonesIsSetAsync(token); - return Ok(); - } } } From 1e835b1ae67c310fb587448ac9e2a34cfb48aeef Mon Sep 17 00:00:00 2001 From: Frolov-Nikita Date: Tue, 8 Aug 2023 13:14:03 +0500 Subject: [PATCH 6/6] Notification add route parametr for DELETE method --- AsbCloudWebApi/Controllers/NotificationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudWebApi/Controllers/NotificationController.cs b/AsbCloudWebApi/Controllers/NotificationController.cs index ebb738e4..a954d2a9 100644 --- a/AsbCloudWebApi/Controllers/NotificationController.cs +++ b/AsbCloudWebApi/Controllers/NotificationController.cs @@ -131,7 +131,7 @@ public class NotificationController : ControllerBase /// Id уведомления /// /// - [HttpDelete] + [HttpDelete("{idNotification}")] public async Task DeleteAsync([Required] int idNotification, CancellationToken cancellationToken) {