diff --git a/AsbCloudApp/CyclycArray.cs b/AsbCloudApp/CyclycArray.cs
index 472957f1..f47edc5b 100644
--- a/AsbCloudApp/CyclycArray.cs
+++ b/AsbCloudApp/CyclycArray.cs
@@ -91,7 +91,7 @@ namespace System.Collections.Generic
get
{
if (used == 0)
- return default;
+ throw new IndexOutOfRangeException();
var i = (current + 1 + index) % used;
return array[i];
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/AsbCloudDb/Model/DailyReport/Bha.cs b/AsbCloudDb/Model/DailyReport/Bha.cs
index 5167c4b8..92c5c9b8 100644
--- a/AsbCloudDb/Model/DailyReport/Bha.cs
+++ b/AsbCloudDb/Model/DailyReport/Bha.cs
@@ -5,58 +5,57 @@
///
/// КНБК описание
///
- public string BHADescription { get; set; }
+ public string BHADescription { get; set; } = string.Empty;
///
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
///
- public string ExtensionDrillingOneBegin { get; set; }
+ public string ExtensionDrillingOneBegin { get; set; } = string.Empty;
///
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
///
- public string ExtensionDrillingOneFinish { get; set; }
+ public string ExtensionDrillingOneFinish { get; set; } = string.Empty;
///
/// Промывка. Время начала
///
- public string SluiceBegin { get; set; }
+ public string SluiceBegin { get; set; } = string.Empty;
///
/// Промывка. Время окончания
///
- public string SluiceFinish { get; set; }
+ public string SluiceFinish { get; set; } = string.Empty;
///
/// Подьем КНБК. Время начала
///
- public string ClimbBegin { get; set; }
+ public string ClimbBegin { get; set; } = string.Empty;
///
/// Подьем КНБК. Время окончания
///
- public string ClimbFinish { get; set; }
+ public string ClimbFinish { get; set; } = string.Empty;
///
/// Спуск КНБК. Время начала
///
- public string DescentBegin { get; set; }
+ public string DescentBegin { get; set; } = string.Empty;
///
/// Спуск КНБК. Время окончания
///
- public string DescentFinish { get; set; }
+ public string DescentFinish { get; set; } = string.Empty;
///
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
///
- public string ExtensionDrillingTwoBegin { get; set; }
+ public string ExtensionDrillingTwoBegin { get; set; } = string.Empty;
///
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
///
- public string ExtensionDrillingTwoFinish { get; set; }
+ public string ExtensionDrillingTwoFinish { get; set; } = string.Empty;
}
}
-
diff --git a/AsbCloudDb/Model/DailyReport/Head.cs b/AsbCloudDb/Model/DailyReport/Head.cs
index 8d90a556..16ef0fc1 100644
--- a/AsbCloudDb/Model/DailyReport/Head.cs
+++ b/AsbCloudDb/Model/DailyReport/Head.cs
@@ -6,22 +6,22 @@ namespace AsbCloudDb.Model.DailyReport
///
/// название скважины
///
- public string WellName { get; set; }
+ public string WellName { get; set; } = string.Empty;
///
/// название куста
///
- public string ClusterName { get; set; }
+ public string ClusterName { get; set; } = string.Empty;
///
/// заказчик
///
- public string Customer { get; set; }
+ public string Customer { get; set; } = string.Empty;
///
/// подрядчик
///
- public string Contractor { get; set; }
+ public string Contractor { get; set; } = string.Empty;
///
/// дата рапорта
@@ -61,12 +61,12 @@ namespace AsbCloudDb.Model.DailyReport
///
/// ФИО бурильщиков
///
- public string FirstDriller { get; set; }
+ public string FirstDriller { get; set; } = string.Empty;
///
/// ФИО бурильщиков
///
- public string SecondDriller { get; set; }
+ public string SecondDriller { get; set; } = string.Empty;
///
/// Время работы АПД
diff --git a/AsbCloudDb/Model/DailyReport/Saub.cs b/AsbCloudDb/Model/DailyReport/Saub.cs
index dae26861..7399f148 100644
--- a/AsbCloudDb/Model/DailyReport/Saub.cs
+++ b/AsbCloudDb/Model/DailyReport/Saub.cs
@@ -72,32 +72,32 @@ namespace AsbCloudDb.Model.DailyReport
///
/// указываются все причины, которые влияют на снижение МСП.
///
- public string DeclinesReasonsROP { get; set; }
+ public string DeclinesReasonsROP { get; set; } = string.Empty;
///
/// Увеличение мех скорости за секцию %
///
- public string IncreaseSpeedSection { get; set; }
+ public string IncreaseSpeedSection { get; set; } = string.Empty;
///
/// Увеличение мех скорости за сутки %
///
- public string IncreaseSpeedDay { get; set; }
+ public string IncreaseSpeedDay { get; set; } = string.Empty;
///
/// Сокращение времени бурения за секцию, ч
///
- public string ReductionTimeDrilling { get; set; }
+ public string ReductionTimeDrilling { get; set; } = string.Empty;
///
/// Ротор/Слайд %
///
- public string RotorSlidePercent { get; set; }
+ public string RotorSlidePercent { get; set; } = string.Empty;
///
/// МСП
///
- public string MspSection { get; set; }
+ public string MspSection { get; set; } = string.Empty;
}
}
diff --git a/AsbCloudDb/Model/DailyReport/Sign.cs b/AsbCloudDb/Model/DailyReport/Sign.cs
index ebef294d..78271fe9 100644
--- a/AsbCloudDb/Model/DailyReport/Sign.cs
+++ b/AsbCloudDb/Model/DailyReport/Sign.cs
@@ -5,12 +5,12 @@
///
/// ФИО Мастера буровой
///
- public string DrillingMaster { get; set; }
+ public string DrillingMaster { get; set; } = string.Empty;
///
/// ФИО супервайзера
///
- public string Supervisor { get; set; }
+ public string Supervisor { get; set; } = string.Empty;
}
}
diff --git a/AsbCloudDb/Model/DailyReport/TimeBalance.cs b/AsbCloudDb/Model/DailyReport/TimeBalance.cs
index a2d3a7e7..ee8c19f7 100644
--- a/AsbCloudDb/Model/DailyReport/TimeBalance.cs
+++ b/AsbCloudDb/Model/DailyReport/TimeBalance.cs
@@ -5,92 +5,92 @@
///
/// Бурение
///
- public string Drilling { get; set; }
+ public string Drilling { get; set; } = string.Empty;
///
/// Промывка
///
- public string Flushing { get; set; }
+ public string Flushing { get; set; } = string.Empty;
///
/// Наращивание
///
- public string Building { get; set; }
+ public string Building { get; set; } = string.Empty;
///
/// Проработка
///
- public string Elaboration { get; set; }
+ public string Elaboration { get; set; } = string.Empty;
///
/// Расширка
///
- public string Extension { get; set; }
+ public string Extension { get; set; } = string.Empty;
///
/// Ремонт
///
- public string Repair { get; set; }
+ public string Repair { get; set; } = string.Empty;
///
/// КНБК
///
- public string Knbk { get; set; }
+ public string Knbk { get; set; } = string.Empty;
///
/// СПО
///
- public string Spo { get; set; }
+ public string Spo { get; set; } = string.Empty;
///
/// ПЗР
///
- public string Pzr { get; set; }
+ public string Pzr { get; set; } = string.Empty;
///
/// ПВО
///
- public string Pvo { get; set; }
+ public string Pvo { get; set; } = string.Empty;
///
/// ПГР
///
- public string Pgr { get; set; }
+ public string Pgr { get; set; } = string.Empty;
///
/// ГИС
///
- public string Gis { get; set; }
+ public string Gis { get; set; } = string.Empty;
///
/// ОЗЦ
///
- public string Ozc { get; set; }
+ public string Ozc { get; set; } = string.Empty;
///
/// Тех. работы
///
- public string EngineeringWorks { get; set; }
+ public string EngineeringWorks { get; set; } = string.Empty;
///
/// Снятие замера
///
- public string TakingMeasure { get; set; }
+ public string TakingMeasure { get; set; } = string.Empty;
///
/// Цементирование
///
- public string Cementing { get; set; }
+ public string Cementing { get; set; } = string.Empty;
///
/// Простой
///
- public string Simple { get; set; }
+ public string Simple { get; set; } = string.Empty;
///
/// НПВ
///
- public string Npv { get; set; }
+ public string Npv { get; set; } = string.Empty;
}
}
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index a7bf3469..b55581ce 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.AddMemoryCache();
services.AddScoped(provider => provider.GetService());
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
index 1ba5b36d..67e66eb5 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
@@ -12,6 +12,7 @@ using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Requests;
using AsbCloudInfrastructure.Services.DetectOperations;
using AsbCloudApp.Data.DetectedOperation;
+using AsbCloudApp.Exceptions;
namespace AsbCloudInfrastructure.Services.DailyReport
{
@@ -34,7 +35,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
{
var well = wellService.GetOrDefault(idWell);
if (well is null || well.Timezone is null)
- return null;
+ throw new ArgumentInvalidException("idWell doesn`t exist", nameof(idWell));
+
var query = db.DailyReports.Where(r => r.IdWell == idWell);
DateTimeOffset ExtractDate(DateTime dateTime)
@@ -65,9 +67,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public async Task GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token)
{
var dateOnly = DateTime.SpecifyKind(date.Date, DateTimeKind.Utc);
- var dailyReportDto = await GetAsync(idWell, dateOnly, token);
- if (dailyReportDto is null)
- dailyReportDto = await MakeDefaultDailyReportAsync(idWell, dateOnly, token);
+ var dailyReportDto = await GetOrDefaultAsync(idWell, dateOnly, token);
+ dailyReportDto ??= await MakeDefaultDailyReportAsync(idWell, dateOnly, token);
return dailyReportDto;
}
@@ -105,7 +106,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public async Task MakeReportAsync(int idWell, DateTime date, CancellationToken token = default)
{
- var dailyReportDto = await GetAsync(idWell, date, token);
+ var dailyReportDto = await GetOrDefaultAsync(idWell, date, token);
if (dailyReportDto is null)
return null;
@@ -113,7 +114,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
return memoryStream;
}
- private async Task GetAsync(int idWell, DateTime date, CancellationToken token)
+ private async Task GetOrDefaultAsync(int idWell, DateTime date, CancellationToken token)
{
var dateOffset = date.Date;
var entity = await db.DailyReports
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}")]