forked from ddrilling/AsbCloudServer
fix validators. lat, long is nullable.
This commit is contained in:
parent
9e546a4cfd
commit
fc752e8f3b
@ -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");
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user