Validation fixes, finished application creation, added required char (*) for required fields
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| using ApplicationLayer.InfrastructureServicesInterfaces; | ||||
| using Domains; | ||||
| using FluentValidation; | ||||
|  | ||||
| namespace ApplicationLayer.Services.VisaApplications.Models.Validation; | ||||
| @@ -21,6 +22,10 @@ public class PastVisaModelValidator : AbstractValidator<PastVisaModel> | ||||
|  | ||||
|         RuleFor(v => v.Name) | ||||
|             .NotEmpty() | ||||
|             .WithMessage("Name of past visa can not be empty"); | ||||
|             .WithMessage("Name of past visa can not be empty") | ||||
|             .Matches(Constants.EnglishPhraseRegex) | ||||
|             .WithMessage("Name of past visa can contain only english letters, digits and special symbols") | ||||
|             .MaximumLength(ConfigurationConstraints.VisaNameLength) | ||||
|             .WithMessage($"Past visa name length must be less than {ConfigurationConstraints.VisaNameLength}"); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -23,6 +23,8 @@ public class PastVisitModelValidator : AbstractValidator<PastVisitModel> | ||||
|         RuleFor(v => v.DestinationCountry) | ||||
|             .NotEmpty() | ||||
|             .WithMessage("Destination Country of past visit can not be null") | ||||
|             .Matches(Constants.EnglishPhraseRegex) | ||||
|             .WithMessage("Destination Country of past visit can contain only english letters, digits and special symbols") | ||||
|             .MaximumLength(ConfigurationConstraints.CountryNameLength) | ||||
|             .WithMessage($"Destination Country of past visit length must be less than {ConfigurationConstraints.CountryNameLength}"); | ||||
|     } | ||||
|   | ||||
| @@ -17,6 +17,8 @@ public class PermissionToDestCountryModelValidator : AbstractValidator<Permissio | ||||
|         RuleFor(p => p!.Issuer) | ||||
|             .NotEmpty() | ||||
|             .WithMessage("Issuer of permission for destination Country can not be empty") | ||||
|             .Matches(Constants.EnglishPhraseRegex) | ||||
|             .WithMessage("Issuer of permission for destination Country can contain only english letters, digits and special symbols") | ||||
|             .MaximumLength(ConfigurationConstraints.IssuerNameLength) | ||||
|             .WithMessage($"Issuer of permission to destination Country length must be less than {ConfigurationConstraints.IssuerNameLength}"); | ||||
|     } | ||||
|   | ||||
| @@ -11,6 +11,8 @@ public class ReentryPermitModelValidator : AbstractValidator<ReentryPermitModel? | ||||
|         RuleFor(p => p!.Number) | ||||
|             .NotEmpty() | ||||
|             .WithMessage("Re-entry permit number can not be empty") | ||||
|             .Matches(Constants.EnglishPhraseRegex) | ||||
|             .WithMessage("Re-entry permit number can contain only english letters, digits and special symbols") | ||||
|             .MaximumLength(ConfigurationConstraints.ReentryPermitNumberLength) | ||||
|             .WithMessage($"Re-entry permit number length must be less than {ConfigurationConstraints.ReentryPermitNumberLength}"); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user