From fc752e8f3bef1f3166ea30f5fa522b8e3e3c9c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Tue, 1 Feb 2022 17:55:56 +0500 Subject: [PATCH] fix validators. lat, long is nullable. --- AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs | 4 ++-- AsbCloudInfrastructure/Validators/DepositDtoValidator.cs | 4 ++-- AsbCloudInfrastructure/Validators/WellDtoValidator.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs b/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs index 8af419d0..b927228e 100644 --- a/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/ClusterDtoValidator.cs @@ -9,9 +9,9 @@ namespace AsbCloudInfrastructure.Validators { RuleFor(x => x.Caption).Length(1, 50) .WithMessage("Допустимая длина названия от 1 до 50 символов"); - RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90) + RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90) .WithMessage("Допустимые значения широты от -90 до 90"); - RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180) + RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180) .WithMessage("Допустимые значения долготы от -180 до 180"); RuleFor(x => x.IdDeposit).GreaterThan(0) .WithMessage("Id не может быть меньше 1"); diff --git a/AsbCloudInfrastructure/Validators/DepositDtoValidator.cs b/AsbCloudInfrastructure/Validators/DepositDtoValidator.cs index a98008b1..dd4cfbbc 100644 --- a/AsbCloudInfrastructure/Validators/DepositDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/DepositDtoValidator.cs @@ -9,9 +9,9 @@ namespace AsbCloudInfrastructure.Validators { RuleFor(x => x.Caption).Length(1, 50) .WithMessage("Допустимая длина названия от 1 до 50 символов"); - RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90) + RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90) .WithMessage("Допустимые значения широты от -90 до 90"); - RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180) + RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180) .WithMessage("Допустимые значения долготы от -180 до 180"); } } diff --git a/AsbCloudInfrastructure/Validators/WellDtoValidator.cs b/AsbCloudInfrastructure/Validators/WellDtoValidator.cs index e75490cc..bb7e1c9e 100644 --- a/AsbCloudInfrastructure/Validators/WellDtoValidator.cs +++ b/AsbCloudInfrastructure/Validators/WellDtoValidator.cs @@ -7,9 +7,9 @@ namespace AsbCloudInfrastructure.Validators { public WellDtoValidator() { - RuleFor(x => x.Latitude).Must(lat => lat is <= 90 and >= -90) + RuleFor(x => x.Latitude).Must(l => l is null or <= 90 and >= -90) .WithMessage("Допустимые значения широты от -90 до 90"); - RuleFor(x => x.Longitude).Must(lat => lat is <= 180 and >= -180) + RuleFor(x => x.Longitude).Must(l => l is null or <= 180 and >= -180) .WithMessage("Допустимые значения долготы от -180 до 180"); } }