From 0e662d48685585fd12e9592ebbcebf577e6ec7f9 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Tue, 17 Aug 2021 09:39:05 +0500 Subject: [PATCH] Fixed controllers routes --- AsbCloudWebApi/Controllers/DataController.cs | 5 ++--- AsbCloudWebApi/Controllers/FluidController.cs | 2 +- AsbCloudWebApi/Controllers/MessageController.cs | 5 ++--- AsbCloudWebApi/Controllers/MudDiagramController.cs | 2 +- AsbCloudWebApi/Controllers/NnbDataController.cs | 2 +- AsbCloudWebApi/Controllers/ReportController.cs | 11 +++++------ .../Controllers/TelemetryAnalyticsController.cs | 12 ++++++------ .../Controllers/WellOperationController.cs | 6 +++--- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/AsbCloudWebApi/Controllers/DataController.cs b/AsbCloudWebApi/Controllers/DataController.cs index 1b86617b..261c5d00 100644 --- a/AsbCloudWebApi/Controllers/DataController.cs +++ b/AsbCloudWebApi/Controllers/DataController.cs @@ -13,7 +13,7 @@ namespace AsbCloudWebApi.Controllers /// /// Контроллер сбора данных от буровых /// - [Route("api/well")] + [Route("api/well/{idWell}/data")] [ApiController] [Authorize] public class DataController : ControllerBase @@ -38,7 +38,6 @@ namespace AsbCloudWebApi.Controllers /// Токен завершения задачи /// [HttpGet] - [Route("{idWell}/data")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetDataAsync(int idWell, DateTime begin = default, int intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default) @@ -61,7 +60,7 @@ namespace AsbCloudWebApi.Controllers /// Токен завершения задачи /// [HttpGet] - [Route("{idWell}/dataDatesRange")] + [Route("dataDatesRange")] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetDataDatesRangeAsync(int idWell, CancellationToken token = default) diff --git a/AsbCloudWebApi/Controllers/FluidController.cs b/AsbCloudWebApi/Controllers/FluidController.cs index 46550cf7..d3ee8780 100644 --- a/AsbCloudWebApi/Controllers/FluidController.cs +++ b/AsbCloudWebApi/Controllers/FluidController.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; namespace AsbCloudWebApi.Controllers { - [Route("api/fluidLastData/{idWell}")] + [Route("api/well/{idWell}/fluidLastData")] [ApiController] [Authorize] public class FluidController : LastDataController diff --git a/AsbCloudWebApi/Controllers/MessageController.cs b/AsbCloudWebApi/Controllers/MessageController.cs index fb44ae61..66c8d409 100644 --- a/AsbCloudWebApi/Controllers/MessageController.cs +++ b/AsbCloudWebApi/Controllers/MessageController.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace AsbCloudWebApi.Controllers { - [Route("api/well")] + [Route("api/well/{idWell}/message")] [ApiController] public class MessageController : ControllerBase { @@ -34,7 +34,6 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// список сообщений по скважине [HttpGet] - [Route("{idWell}/message")] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] public async Task GetMessagesAsync(int idWell, int skip = 0, int take = 32, [FromQuery] IEnumerable categoryids = default, @@ -65,7 +64,7 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// список сообщений по скважине [HttpGet] - [Route("{idWell}/messagesDatesRange")] + [Route("datesRange")] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetMessagesDateRangeAsync(int idWell, CancellationToken token = default) diff --git a/AsbCloudWebApi/Controllers/MudDiagramController.cs b/AsbCloudWebApi/Controllers/MudDiagramController.cs index 48551e9f..f34d9c0f 100644 --- a/AsbCloudWebApi/Controllers/MudDiagramController.cs +++ b/AsbCloudWebApi/Controllers/MudDiagramController.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; namespace AsbCloudWebApi.Controllers { - [Route("api/mudLastData/{idWell}")] + [Route("api/well/{idWell}/mudLastData")] [ApiController] [Authorize] public class MudDiagramController : LastDataController diff --git a/AsbCloudWebApi/Controllers/NnbDataController.cs b/AsbCloudWebApi/Controllers/NnbDataController.cs index 67403b37..511d5149 100644 --- a/AsbCloudWebApi/Controllers/NnbDataController.cs +++ b/AsbCloudWebApi/Controllers/NnbDataController.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; namespace AsbCloudWebApi.Controllers { - [Route("api/nnbLastData/{idWell}")] + [Route("api/well/{idWell}/nnbLastData")] [ApiController] [Authorize] public class NnbDataController : LastDataController diff --git a/AsbCloudWebApi/Controllers/ReportController.cs b/AsbCloudWebApi/Controllers/ReportController.cs index cf1c91d8..a42e6710 100644 --- a/AsbCloudWebApi/Controllers/ReportController.cs +++ b/AsbCloudWebApi/Controllers/ReportController.cs @@ -15,7 +15,7 @@ namespace AsbCloudWebApi.Controllers /// /// Контроллер отчетов по буровым скважинам /// - [Route("api/report")] + [Route("api/well/{idWell}/report")] [ApiController] public class ReportController : ControllerBase { @@ -64,7 +64,6 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// id фоновой задачи формирования отчета [HttpPost] - [Route("{idWell}/report")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task CreateReportAsync(int idWell, int idUser, int stepSeconds, int format, DateTime begin = default, DateTime end = default, @@ -93,7 +92,7 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// файл с отчетом [HttpGet] - [Route("{idWell}/{reportName}")] + [Route("{reportName}")] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportAsync([FromRoute] int idWell, string reportName, CancellationToken token = default) @@ -132,7 +131,7 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// Список имен существующих отчетов (отчетов) [HttpGet] - [Route("{idWell}/suitableReports")] + [Route("suitableReports")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetSuitableReportsNamesAsync(int idWell, int stepSeconds, int format, DateTime begin = default, DateTime end = default, @@ -158,7 +157,7 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// прогнозируемое кол-во страниц отчета [HttpGet] - [Route("{idWell}/reportSize")] + [Route("reportSize")] [ProducesResponseType(typeof(string), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportSizeAsync(int idWell, int stepSeconds, int format, DateTime begin = default, @@ -186,7 +185,7 @@ namespace AsbCloudWebApi.Controllers /// Токен для отмены задачи /// Даты самого старого и самого свежего отчетов в БД [HttpGet] - [Route("{idWell}/reportsDatesRange")] + [Route("datesRange")] [ProducesResponseType(typeof(DatesRangeDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetReportsDateRangeAsync(int idWell, CancellationToken token = default) diff --git a/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs b/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs index 2f129f8f..578b8842 100644 --- a/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryAnalyticsController.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; namespace AsbCloudWebApi.Controllers { - [Route("api/analytics")] + [Route("api/well/{idWell}/telemetryAnalytics")] [ApiController] [Authorize] public class TelemetryAnalyticsController : ControllerBase @@ -36,7 +36,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Список операций на скважине за все время [HttpGet] - [Route("{idWell}/operationsByWell")] + [Route("operationsByWell")] [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] public async Task GetOperationsByWellAsync(int idWell, int skip = 0, int take = 32, [FromQuery] IEnumerable categoryIds = default, DateTime begin = default, DateTime end = default, @@ -64,7 +64,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Коллекцию данных по скважине "глубина-день" [HttpGet] - [Route("{idWell}/wellDepthToDay")] + [Route("wellDepthToDay")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetWellDepthToDayAsync(int idWell, CancellationToken token = default) @@ -93,7 +93,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Коллекцию данных по глубине скважины за период [HttpGet] - [Route("{idWell}/wellDepthToInterval")] + [Route("wellDepthToInterval")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetWellDepthToIntervalAsync(int idWell, int intervalSeconds, int workBeginSeconds, CancellationToken token = default) @@ -122,7 +122,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Коллекцию операций на скважине [HttpGet] - [Route("{idWell}/operationsSummary")] + [Route("operationsSummary")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetOperationsSummaryAsync(int idWell, DateTime begin = default, DateTime end = default, CancellationToken token = default) @@ -151,7 +151,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Коллекцию операций на скважине [HttpGet] - [Route("{idWell}/operationsToInterval")] + [Route("operationsToInterval")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] public async Task GetOperationsToIntervalAsync(int idWell, int intervalSeconds, int workBeginSeconds, CancellationToken token = default) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index df9e2203..9248cb99 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -11,7 +11,7 @@ namespace AsbCloudWebApi.Controllers /// /// Контроллер вручную внесенных операций на скважине /// - [Route("api/wellOperations")] + [Route("api/well/{idWell}/wellOperations")] [ApiController] [Authorize] public class WellOperationController : ControllerBase @@ -30,9 +30,9 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpGet] - [Route("types")] + [Route("categories")] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] - public IActionResult GetTypes() + public IActionResult GetCategories() { var result = operationService.GetCategories(); return Ok(result);