From 8a3bcf311ff2611996ece0329ba2fc56a8161f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D1=80=D1=87=D0=B5=D0=BD=D0=BA=D0=BE=20=D0=92?= =?UTF-8?q?=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80?= Date: Thu, 20 Jan 2022 12:07:15 +0500 Subject: [PATCH] Fixed dto ids validation --- AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs | 2 +- .../Validators/DrillFlowChartDtoValidator.cs | 8 ++++---- AsbCloudInfrastructure/Validators/EventDtoValidator.cs | 6 +++--- AsbCloudInfrastructure/Validators/FileInfoDtoValidator.cs | 4 ++-- AsbCloudInfrastructure/Validators/FileMarkDtoValidator.cs | 4 ++-- AsbCloudInfrastructure/Validators/MeasureDtoValidator.cs | 4 ++-- AsbCloudInfrastructure/Validators/MessageDtoValidator.cs | 4 ++-- .../Validators/ReportPropertiesDtoValidator.cs | 2 +- AsbCloudInfrastructure/Validators/UserRoleDtoValidator.cs | 2 +- .../Validators/WellOperationDtoValidator.cs | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs b/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs index e225c615..8af419d0 100644 --- a/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs @@ -13,7 +13,7 @@ namespace AsbCloudInfrastructure.Validators .WithMessage("Допустимые значения широты от -90 до 90"); RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180) .WithMessage("Допустимые значения долготы от -180 до 180"); - RuleFor(x => x.IdDeposit).LessThan(1) + RuleFor(x => x.IdDeposit).GreaterThan(0) .WithMessage("Id не может быть меньше 1"); } } diff --git a/AsbCloudInfrastructure/Validators/DrillFlowChartDtoValidator.cs b/AsbCloudInfrastructure/Validators/DrillFlowChartDtoValidator.cs index ea6e29e9..78e83056 100644 --- a/AsbCloudInfrastructure/Validators/DrillFlowChartDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/DrillFlowChartDtoValidator.cs @@ -7,13 +7,13 @@ namespace AsbCloudInfrastructure.Validators { public DrillFlowChartDtoValidator() { - RuleFor(x => x.IdWell).LessThan(1) + RuleFor(x => x.IdWell).GreaterThan(0) .WithMessage("Id скважины не может быть меньше 1"); - RuleFor(x => x.IdWellOperationCategory).LessThan(1) + RuleFor(x => x.IdWellOperationCategory).GreaterThan(0) .WithMessage("Id категории операции не может быть меньше 1"); - RuleFor(x => x.DepthStart).LessThan(1) + RuleFor(x => x.DepthStart).GreaterThan(-1) .WithMessage("Глубина не может быть отрицательной"); - RuleFor(x => x.DepthEnd).LessThan(1) + RuleFor(x => x.DepthEnd).GreaterThan(-1) .WithMessage("Глубина не может быть отрицательной"); } } diff --git a/AsbCloudInfrastructure/Validators/EventDtoValidator.cs b/AsbCloudInfrastructure/Validators/EventDtoValidator.cs index 60846369..14c18858 100644 --- a/AsbCloudInfrastructure/Validators/EventDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/EventDtoValidator.cs @@ -7,11 +7,11 @@ namespace AsbCloudInfrastructure.Validators { public EventDtoValidator() { - RuleFor(x => x.IdCategory).LessThan(0) + RuleFor(x => x.IdCategory).GreaterThan(0) .WithMessage("Id категории события не может быть отрицательным"); - RuleFor(x => x.EventType).LessThan(0) + RuleFor(x => x.EventType).GreaterThan(0) .WithMessage("Id типа события не может быть отрицательным"); - RuleFor(x => x.IdSound).LessThan(0) + RuleFor(x => x.IdSound).GreaterThan(0) .WithMessage("Id звука оповещения не может быть отрицательным"); } } diff --git a/AsbCloudInfrastructure/Validators/FileInfoDtoValidator.cs b/AsbCloudInfrastructure/Validators/FileInfoDtoValidator.cs index 42fb9431..347181fd 100644 --- a/AsbCloudInfrastructure/Validators/FileInfoDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/FileInfoDtoValidator.cs @@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators { public FileInfoDtoValidator() { - RuleFor(x => x.IdWell).LessThan(1) + RuleFor(x => x.IdWell).GreaterThan(0) .WithMessage("Id скважины не может быть меньше 1"); - RuleFor(x => x.IdCategory).LessThan(1) + RuleFor(x => x.IdCategory).GreaterThan(0) .WithMessage("Id категории файла не может быть меньше 1"); RuleFor(x => x.Name).Length(1, 50) .WithMessage("Допустимое имя файла от 1 до 50 символов"); diff --git a/AsbCloudInfrastructure/Validators/FileMarkDtoValidator.cs b/AsbCloudInfrastructure/Validators/FileMarkDtoValidator.cs index eda4c8b4..d70982c7 100644 --- a/AsbCloudInfrastructure/Validators/FileMarkDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/FileMarkDtoValidator.cs @@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators { public FileMarkDtoValidator() { - RuleFor(x => x.IdFile).LessThan(1) + RuleFor(x => x.IdFile).GreaterThan(0) .WithMessage("Id файла не может быть ниже 1"); - RuleFor(x => x.IdMarkType).LessThan(1) + RuleFor(x => x.IdMarkType).GreaterThan(0) .WithMessage("Id категории действия с файлом не может быть ниже 1"); RuleFor(x => x.Comment).MaximumLength(200) .WithMessage("Длина текста комментария не может быть выше 200 символов"); diff --git a/AsbCloudInfrastructure/Validators/MeasureDtoValidator.cs b/AsbCloudInfrastructure/Validators/MeasureDtoValidator.cs index 9fdf87cb..c4a33458 100644 --- a/AsbCloudInfrastructure/Validators/MeasureDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/MeasureDtoValidator.cs @@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators { public MeasureDtoValidator() { - RuleFor(x => x.IdWell).LessThan(1) + RuleFor(x => x.IdWell).GreaterThan(0) .WithMessage("Id скважины не может быть меньше 1"); - RuleFor(x => x.IdCategory).LessThan(1) + RuleFor(x => x.IdCategory).GreaterThan(0) .WithMessage("Id категории не может быть меньше 1"); RuleFor(x => x.CategoryName).MaximumLength(50) .WithMessage("Название категории не может быть больше 50 символов"); diff --git a/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs b/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs index e7898745..acec9778 100644 --- a/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/MessageDtoValidator.cs @@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators { public MessageDtoValidator() { - RuleFor(x => x.CategoryId).LessThan(1) + RuleFor(x => x.CategoryId).GreaterThan(0) .WithMessage("Id категории не может быть ниже 1"); - RuleFor(x => x.WellDepth).LessThan(1) + RuleFor(x => x.WellDepth).GreaterThan(-1) .WithMessage("Id скважины не может быть ниже 1"); RuleFor(x => x.Message).Length(1, 200) .WithMessage("Допустимая длина текста сообщения от 1 до 200 символов"); diff --git a/AsbCloudInfrastructure/Validators/ReportPropertiesDtoValidator.cs b/AsbCloudInfrastructure/Validators/ReportPropertiesDtoValidator.cs index 90d072e6..a908a5f8 100644 --- a/AsbCloudInfrastructure/Validators/ReportPropertiesDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/ReportPropertiesDtoValidator.cs @@ -9,7 +9,7 @@ namespace AsbCloudInfrastructure.Validators { RuleFor(x => x.Name).Length(1, 50) .WithMessage("Допустимая длина имени файла от 1 до 50 символов"); - RuleFor(x => x.IdWell).LessThan(1) + RuleFor(x => x.IdWell).GreaterThan(0) .WithMessage("Id скважины не может быть меньше 1"); } } diff --git a/AsbCloudInfrastructure/Validators/UserRoleDtoValidator.cs b/AsbCloudInfrastructure/Validators/UserRoleDtoValidator.cs index c1ed5f72..38563a2d 100644 --- a/AsbCloudInfrastructure/Validators/UserRoleDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/UserRoleDtoValidator.cs @@ -9,7 +9,7 @@ namespace AsbCloudInfrastructure.Validators { RuleFor(x => x.Caption).Length(0, 50) .WithMessage("Допустимая длина названия роли от 1 до 50 символов"); - RuleFor(x => x.IdType).LessThan(1) + RuleFor(x => x.IdType).GreaterThan(0) .WithMessage("Id типа роли не может быть ниже 1"); } } diff --git a/AsbCloudInfrastructure/Validators/WellOperationDtoValidator.cs b/AsbCloudInfrastructure/Validators/WellOperationDtoValidator.cs index 6202eeb9..f88cdada 100644 --- a/AsbCloudInfrastructure/Validators/WellOperationDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/WellOperationDtoValidator.cs @@ -7,7 +7,7 @@ namespace AsbCloudInfrastructure.Validators { public WellOperationDtoValidator() { - RuleFor(x => x.IdWell).LessThan(1) + RuleFor(x => x.IdWell).GreaterThan(0) .WithMessage("Id скважины не может быть меньше 1"); RuleFor(x => x.Comment).MaximumLength(400) .WithMessage("Комментарий не может быть длиннее 400 символов");