From c78246ca7d8cf575bbaa0b42c57e8fcf8dc303c9 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Thu, 17 Nov 2022 17:54:25 +0500 Subject: [PATCH] fix some nit warnings --- .../Data/Subsystems/SubsystemActiveWellStatDto.cs | 2 +- .../Repositories/IFileStorageRepository.cs | 1 - AsbCloudApp/Services/FileService.cs | 9 --------- AsbCloudApp/Services/IAuthService.cs | 7 +++++-- AsbCloudApp/Services/IFileCategoryService.cs | 6 ++++++ .../Services/Subsystems/ISubsystemService.cs | 11 +++++++++++ AsbCloudDb/Model/AsbCloudDbContext.cs | 15 +-------------- AsbCloudInfrastructure/DependencyInjection.cs | 3 ++- AsbCloudWebApi/Controllers/FileController.cs | 7 +++---- 9 files changed, 29 insertions(+), 32 deletions(-) diff --git a/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs b/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs index 2b62f171..2aee1d7f 100644 --- a/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs +++ b/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs @@ -10,7 +10,7 @@ namespace AsbCloudApp.Data.Subsystems /// /// Активная скважина /// - public WellDto Well { get; set; } + public WellDto Well { get; set; } = null!; /// /// Наработки подсистемы АКБ /// diff --git a/AsbCloudApp/Repositories/IFileStorageRepository.cs b/AsbCloudApp/Repositories/IFileStorageRepository.cs index 0d867db0..6118cc7a 100644 --- a/AsbCloudApp/Repositories/IFileStorageRepository.cs +++ b/AsbCloudApp/Repositories/IFileStorageRepository.cs @@ -51,7 +51,6 @@ namespace AsbCloudApp.Repositories /// /// Вывод списка всех файлов из базы, для которых нет файла на диске /// - /// /// /// IEnumerable GetListFilesNotDisc(IEnumerable files); diff --git a/AsbCloudApp/Services/FileService.cs b/AsbCloudApp/Services/FileService.cs index 3ba250aa..9b7ca156 100644 --- a/AsbCloudApp/Services/FileService.cs +++ b/AsbCloudApp/Services/FileService.cs @@ -165,15 +165,6 @@ namespace AsbCloudApp.Services public async Task> GetInfoByIdsAsync(IEnumerable idsFile, CancellationToken token) { var result = await fileRepository.GetInfoByIdsAsync(idsFile, token).ConfigureAwait(false); - - foreach (var entity in result) - { - - var ext = Path.GetExtension(entity.Name); - var relativePath = GetUrl(entity.IdWell, entity.IdCategory, entity.Id, ext); - var fullPath = Path.GetFullPath(relativePath); - } - return result; } diff --git a/AsbCloudApp/Services/IAuthService.cs b/AsbCloudApp/Services/IAuthService.cs index 80e9e3d7..93d14124 100644 --- a/AsbCloudApp/Services/IAuthService.cs +++ b/AsbCloudApp/Services/IAuthService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services { +#nullable enable /// /// Сервис авторизации /// @@ -33,13 +34,14 @@ namespace AsbCloudApp.Services /// /// токен отмены задачи /// - Task LoginAsync(string login, + Task LoginAsync(string login, string password, CancellationToken token = default); /// /// Обновление токена авторизации /// - /// + /// + /// /// Task RefreshAsync(ClaimsPrincipal identity, CancellationToken token); @@ -51,4 +53,5 @@ namespace AsbCloudApp.Services /// int Register(UserRegistrationDto userDto); } +#nullable disable } \ No newline at end of file diff --git a/AsbCloudApp/Services/IFileCategoryService.cs b/AsbCloudApp/Services/IFileCategoryService.cs index 70441331..91ca05a7 100644 --- a/AsbCloudApp/Services/IFileCategoryService.cs +++ b/AsbCloudApp/Services/IFileCategoryService.cs @@ -10,6 +10,12 @@ namespace AsbCloudApp.Services /// public interface IFileCategoryService { + /// + /// Получить категории файлов + /// + /// + /// + /// Task GetOrDefaultAsync(int id, CancellationToken token); /// diff --git a/AsbCloudApp/Services/Subsystems/ISubsystemService.cs b/AsbCloudApp/Services/Subsystems/ISubsystemService.cs index 7daf7d68..ff26a4d2 100644 --- a/AsbCloudApp/Services/Subsystems/ISubsystemService.cs +++ b/AsbCloudApp/Services/Subsystems/ISubsystemService.cs @@ -6,8 +6,19 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services.Subsystems { #nullable enable + // TODO: move this to repositories + + /// + /// репозиторий получения подсистем + /// public interface ISubsystemService { + /// + /// получение списка подсистем. Если скважина указана, то получим только использованные в скважине подсистемы. + /// + /// + /// + /// Task?> GetSubsystemAsync(int? idWell, CancellationToken token); } #nullable disable diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index dc68f38c..31deda55 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -59,15 +59,7 @@ namespace AsbCloudDb.Model public DbSet Record50 => Set(); public DbSet Record60 => Set(); public DbSet Record61 => Set(); - - private System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new() - { - AllowTrailingCommas = true, - WriteIndented = true, - NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | - System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals, - }; - + public AsbCloudDbContext() : base() { } @@ -368,10 +360,5 @@ namespace AsbCloudDb.Model var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};"; return Database.ExecuteSqlRawAsync(sql, token); } - - public Task RefreshMaterializedViewAsync(string? mwName = null, CancellationToken token = default) where TEntity : class - { - throw new System.NotImplementedException(); - } } } diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 0b9c0bc6..aaf00616 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -91,7 +91,8 @@ namespace AsbCloudInfrastructure services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString(connectionStringName))); - services.AddFluentValidation(); + // TODO: переместить FluentValidation в описание моделей + services.AddFluentValidationClientsideAdapters(); services.AddScoped(provider => provider.GetService()); services.AddScoped(); diff --git a/AsbCloudWebApi/Controllers/FileController.cs b/AsbCloudWebApi/Controllers/FileController.cs index 1340c55a..53b2fc52 100644 --- a/AsbCloudWebApi/Controllers/FileController.cs +++ b/AsbCloudWebApi/Controllers/FileController.cs @@ -37,7 +37,7 @@ namespace AsbCloudWebApi.Controllers /// id скважины /// id категории файла /// Коллекция файлов - /// dependency + /// dependency /// Токен отмены задачи /// [HttpPost] @@ -100,7 +100,6 @@ namespace AsbCloudWebApi.Controllers /// /// Возвращает файл с диска на сервере /// - /// id скважины /// id запрашиваемого файла /// Токен отмены задачи /// Запрашиваемый файл @@ -108,7 +107,7 @@ namespace AsbCloudWebApi.Controllers [Route("{idFile}")] [Permission] [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] - public async Task GetFileAsync([FromRoute] int idWell, + public async Task GetFileAsync( int idFile, CancellationToken token = default) { int? idCompany = User.GetCompanyId(); @@ -135,7 +134,7 @@ namespace AsbCloudWebApi.Controllers /// /// id скважины /// id запрашиваемого файла - /// dependency + /// dependency /// Токен отмены задачи /// [HttpDelete("{idFile}")]