diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj index ffc380f4..3e0d80ab 100644 --- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj +++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj @@ -39,7 +39,6 @@ - diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 2da84cc4..f74de38e 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -17,8 +17,6 @@ using AsbCloudInfrastructure.Services.SAUB; using AsbCloudInfrastructure.Services.Subsystems; using AsbCloudInfrastructure.Services.Trajectory; using AsbCloudInfrastructure.Services.WellOperationService; -using AsbCloudInfrastructure.Validators; -using FluentValidation.AspNetCore; using Mapster; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; @@ -92,9 +90,7 @@ namespace AsbCloudInfrastructure #endif services.AddDbContext(options => options.UseNpgsql(configuration.GetConnectionString(connectionStringName))); - - // TODO: переместить FluentValidation в описание моделей - services.AddFluentValidationClientsideAdapters(); + services.AddMemoryCache(); services.AddScoped(provider => provider.GetService()); @@ -195,9 +191,7 @@ namespace AsbCloudInfrastructure services.AddTransient, WitsRecordRepository>(); services.AddTransient, WitsRecordRepository>(); services.AddTransient, WitsRecordRepository>(); - services.AddTransient, WitsRecordRepository>(); - - services.AddValidators(); + services.AddTransient, WitsRecordRepository>(); return services; } diff --git a/AsbCloudInfrastructure/Validators/DependencyInjection.cs b/AsbCloudInfrastructure/Validators/DependencyInjection.cs deleted file mode 100644 index d45dfed9..00000000 --- a/AsbCloudInfrastructure/Validators/DependencyInjection.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; - -namespace AsbCloudInfrastructure.Validators -{ - public static class DependencyInjection - { - public static IServiceCollection AddValidators(this IServiceCollection services) - { - // services.AddTransient, AuthDtoValidator>(); - // services.AddTransient, ClusterDtoValidator>(); - // services.AddTransient, CompanyDtoValidator>(); - // services.AddTransient, DepositDtoValidator>(); - // services.AddTransient, ProcessMapValidator>(); - // services.AddTransient, EventDtoValidator>(); - // services.AddTransient, FileInfoDtoValidator>(); - // services.AddTransient, FileMarkDtoValidator>(); - // services.AddTransient, MeasureDtoValidator>(); - // services.AddTransient, MessageDtoValidator>(); - // services.AddTransient, PermissionDtoValidator>(); - // services.AddTransient, ReportPropertiesDtoValidator>(); - // services.AddTransient, UserRegistrationDtoValidator>(); - // services.AddTransient, UserRoleDtoValidator>(); - // services.AddTransient, WellDtoValidator>(); - // services.AddTransient, WellOperationDtoValidator>(); - // TimeDtoValidator - - return services; - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs b/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs deleted file mode 100644 index 31c84b34..00000000 --- a/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AsbCloudApp.Data; -using FluentValidation; - -namespace AsbCloudInfrastructure.Validators -{ - public class MessageDtoValidator : AbstractValidator - { - - //TODO: в модели дто сообщения отсутствует поле Id скважины - // скорее всего опечатка т.к. используется глубина в правиле валидатора - //в других валидаторах парамтр глубины идет рэнжированный от...до - - public MessageDtoValidator() - { - - RuleFor(x => x.WellDepth).GreaterThan(-1) - .WithMessage("Id скважины не может быть ниже 1"); - - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Validators/TimeDtoValidator.cs b/AsbCloudInfrastructure/Validators/TimeDtoValidator.cs deleted file mode 100644 index 00bdfeb0..00000000 --- a/AsbCloudInfrastructure/Validators/TimeDtoValidator.cs +++ /dev/null @@ -1,28 +0,0 @@ -using AsbCloudApp.Data; -using FluentValidation; - -namespace AsbCloudInfrastructure.Validators -{ - public class TimeDtoValidator : AbstractValidator - { - - //TODO: в текущей реализации данные проверки регулируются в свойстве модели блоком set - // какая предпочтительнее? - - - public TimeDtoValidator() - { - RuleFor(x => x.Hour) - .InclusiveBetween(0, 23) - .WithMessage("hour should be in [0; 23]"); - - RuleFor(x => x.Minute) - .InclusiveBetween(0, 59) - .WithMessage("minute should be in [0; 59]"); - - RuleFor(x => x.Second) - .InclusiveBetween(0, 59) - .WithMessage("second should be in [0; 59]"); - } - } -} diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs index 9d4ff2c6..15f086ae 100644 --- a/ConsoleApp1/Program.cs +++ b/ConsoleApp1/Program.cs @@ -18,10 +18,7 @@ namespace ConsoleApp1 static void Main(/*string[] args*/) { - var n = "-159.99"; - var s = "159.99s"; - var r1 = reg.IsMatch( n ); - var r2 = reg.IsMatch( s ); + } } }