From ef1d2dda91fb5659a9dc83d132ec19e42db245bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Wed, 2 Mar 2022 16:21:07 +0500 Subject: [PATCH] rename some methods --- AsbCloudApp/Services/IOperationsStatService.cs | 2 +- .../Services/DrillingProgram/DrillingProgramService.cs | 2 +- .../WellOperationService/OperationsStatService.cs | 8 ++++---- AsbCloudWebApi/Controllers/DrillingProgramController.cs | 9 ++++----- AsbCloudWebApi/Controllers/OperationStatController.cs | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/AsbCloudApp/Services/IOperationsStatService.cs b/AsbCloudApp/Services/IOperationsStatService.cs index d0689b9e..dddcb371 100644 --- a/AsbCloudApp/Services/IOperationsStatService.cs +++ b/AsbCloudApp/Services/IOperationsStatService.cs @@ -10,7 +10,7 @@ namespace AsbCloudApp.Services Task GetRopStatByIdWellAsync(int idWell, CancellationToken token); Task GetRopStatByUidAsync(string uid, CancellationToken token); Task GetStatClusterAsync(int idCluster, int idCompany, CancellationToken token = default); - Task GetStatWellAsync(int idWell, CancellationToken token = default); + Task GetWellStatAsync(int idWell, CancellationToken token = default); Task>> GetTvdAsync(int idWell, CancellationToken token); Task> GetWellsStatAsync(IEnumerable idWells, CancellationToken token); } diff --git a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs index 2ea4c533..4d1a21aa 100644 --- a/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs +++ b/AsbCloudInfrastructure/Services/DrillingProgram/DrillingProgramService.cs @@ -16,7 +16,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram { public class DrillingProgramService : IDrillingProgramService { - private static Dictionary drillingProgramCreateErrors = new Dictionary(); + private static readonly Dictionary drillingProgramCreateErrors = new Dictionary(); private readonly IAsbCloudDbContext context; private readonly IFileService fileService; diff --git a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs index 90dc885a..1564dc6a 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs @@ -95,13 +95,13 @@ namespace AsbCloudInfrastructure.Services.WellOperationService foreach (var well in wells) { - var statWellDto = await CalcStatWellAsync(well, token); + var statWellDto = await CalcWellStatAsync(well, token); statsWells.Add(statWellDto); } return statsWells; } - public async Task GetStatWellAsync(int idWell, + public async Task GetWellStatAsync(int idWell, CancellationToken token = default) { var well = await db.Wells @@ -109,7 +109,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService .FirstOrDefaultAsync(w => w.Id == idWell, token) .ConfigureAwait(false); - var statWellDto = await CalcStatWellAsync(well, token); + var statWellDto = await CalcWellStatAsync(well, token); return statWellDto; } @@ -160,7 +160,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService return clusterRops; } - private async Task CalcStatWellAsync(Well well, CancellationToken token = default) + private async Task CalcWellStatAsync(Well well, CancellationToken token = default) { var wellType = await cacheWellType.FirstOrDefaultAsync(t => t.Id == well.IdWellType, token); var statWellDto = new StatWellDto() diff --git a/AsbCloudWebApi/Controllers/DrillingProgramController.cs b/AsbCloudWebApi/Controllers/DrillingProgramController.cs index 2f5336d5..2b7677b3 100644 --- a/AsbCloudWebApi/Controllers/DrillingProgramController.cs +++ b/AsbCloudWebApi/Controllers/DrillingProgramController.cs @@ -59,7 +59,6 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// Возвращает файл программы бурения [HttpGet] - [Permission] [ProducesResponseType(typeof(DrillingProgramStateDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetStateAsync(int idWell, CancellationToken token) { @@ -82,7 +81,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpPost("ClearError")] - [Permission] + [Permission("DrillingProgram.get")] public IActionResult ClearError(int idWell) { drillingProgramService.ClearError(idWell); @@ -98,7 +97,7 @@ namespace AsbCloudWebApi.Controllers /// /// [HttpPost("part/{idFileCategory}")] - [Permission] + [Permission("DrillingProgram.get")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task AddFile( int idWell, @@ -249,7 +248,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// [HttpPost("fileMark")] - [Permission] + [Permission("DrillingProgram.get")] public async Task AddOrReplaceFileMarkAsync(int idWell, FileMarkDto markDto, CancellationToken token) { var idCompany = User.GetCompanyId(); @@ -275,7 +274,7 @@ namespace AsbCloudWebApi.Controllers /// Токен отмены задачи /// [HttpDelete("fileMark/{idMark}")] - [Permission] + [Permission("DrillingProgram.get")] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task MarkAsDeletedFileMarkAsync(int idWell, int idMark, CancellationToken token) diff --git a/AsbCloudWebApi/Controllers/OperationStatController.cs b/AsbCloudWebApi/Controllers/OperationStatController.cs index 909e0bb6..a924f41b 100644 --- a/AsbCloudWebApi/Controllers/OperationStatController.cs +++ b/AsbCloudWebApi/Controllers/OperationStatController.cs @@ -126,7 +126,7 @@ namespace AsbCloudWebApi.Controllers if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) return Forbid(); - var result = await operationsStatService.GetStatWellAsync(idWell, token) + var result = await operationsStatService.GetWellStatAsync(idWell, token) .ConfigureAwait(false); return Ok(result); }