Validation fixes, finished application creation, added required char (*) for required fields

This commit is contained in:
2024-09-08 14:13:08 +03:00
parent 142148368f
commit c128349f3b
34 changed files with 372 additions and 100 deletions

View File

@@ -11,12 +11,16 @@ public class PassportModelValidator : AbstractValidator<PassportModel>
RuleFor(r => r.Issuer)
.NotEmpty()
.WithMessage("Passport issuer can not be empty")
.Matches(Constants.EnglishPhraseRegex)
.WithMessage("Passport issuer field can contain only english letters, digits and special symbols")
.MaximumLength(ConfigurationConstraints.IssuerNameLength)
.WithMessage($"Passport issuer length must be less than {ConfigurationConstraints.IssuerNameLength}");
RuleFor(r => r.Number)
.NotEmpty()
.WithMessage("Passport number can not be empty")
.Matches(Constants.EnglishPhraseRegex)
.WithMessage("Passport number field can contain only english letters, digits and special symbols")
.MaximumLength(ConfigurationConstraints.PassportNumberLength)
.WithMessage($"Passport number length must be less than {ConfigurationConstraints.PassportNumberLength}");