refactor (readonly for static objects in tests and file-scoped namespaces
This commit is contained in:
		| @@ -1,21 +1,20 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using VisaApiClient; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models; | ||||
|  | ||||
| /// Model of place of work with attributes required for validation to work | ||||
| public class PlaceOfWorkModel | ||||
| { | ||||
|     /// Model of place of work with attributes required for validation to work | ||||
|     public class PlaceOfWorkModel | ||||
|     { | ||||
|         [Required] | ||||
|         [StringLength(ConfigurationConstraints.PlaceOfWorkNameLength, MinimumLength = 1)] | ||||
|         public string Name { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(ConfigurationConstraints.PlaceOfWorkNameLength, MinimumLength = 1)] | ||||
|     public string Name { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public AddressModel Address { get; set; } = new AddressModel(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public AddressModel Address { get; set; } = new AddressModel(); | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(ConfigurationConstraints.PhoneNumberLength, MinimumLength = ConfigurationConstraints.PhoneNumberMinLength)] | ||||
|         public string PhoneNum { get; set; } = default!; | ||||
|     } | ||||
| } | ||||
|     [Required] | ||||
|     [StringLength(ConfigurationConstraints.PhoneNumberLength, MinimumLength = ConfigurationConstraints.PhoneNumberMinLength)] | ||||
|     public string PhoneNum { get; set; } = default!; | ||||
| } | ||||
| @@ -3,66 +3,65 @@ using Newtonsoft.Json; | ||||
| using Newtonsoft.Json.Converters; | ||||
| using VisaApiClient; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models; | ||||
|  | ||||
| /// Model of request with attributes required for validation to work | ||||
| public class RegisterApplicantRequestModel | ||||
| { | ||||
|     /// Model of request with attributes required for validation to work | ||||
|     public class RegisterApplicantRequestModel | ||||
|     { | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public RegisterRequestModel RegisterRequest { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public RegisterRequestModel RegisterRequest { get; set; } = new(); | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public NameModel ApplicantName { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public NameModel ApplicantName { get; set; } = new(); | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public PassportModel Passport { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public PassportModel Passport { get; set; } = new(); | ||||
|  | ||||
|         [Required(AllowEmptyStrings = true)] | ||||
|         public DateTimeOffset BirthDate { get; set; } | ||||
|     [Required(AllowEmptyStrings = true)] | ||||
|     public DateTimeOffset BirthDate { get; set; } | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(70, MinimumLength = 1)] | ||||
|         public string CityOfBirth { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(70, MinimumLength = 1)] | ||||
|     public string CityOfBirth { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(70, MinimumLength = 1)] | ||||
|         public string CountryOfBirth { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(70, MinimumLength = 1)] | ||||
|     public string CountryOfBirth { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(30, MinimumLength = 1)] | ||||
|         public string Citizenship { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(30, MinimumLength = 1)] | ||||
|     public string Citizenship { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(30, MinimumLength = 1)] | ||||
|         public string CitizenshipByBirth { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(30, MinimumLength = 1)] | ||||
|     public string CitizenshipByBirth { get; set; } = default!; | ||||
|  | ||||
|         [Required(AllowEmptyStrings = true)] | ||||
|         [JsonConverter(typeof(StringEnumConverter))] | ||||
|         public Gender Gender { get; set; } | ||||
|     [Required(AllowEmptyStrings = true)] | ||||
|     [JsonConverter(typeof(StringEnumConverter))] | ||||
|     public Gender Gender { get; set; } | ||||
|  | ||||
|         [Required(AllowEmptyStrings = true)] | ||||
|         [JsonConverter(typeof(StringEnumConverter))] | ||||
|         public MaritalStatus MaritalStatus { get; set; } | ||||
|     [Required(AllowEmptyStrings = true)] | ||||
|     [JsonConverter(typeof(StringEnumConverter))] | ||||
|     public MaritalStatus MaritalStatus { get; set; } | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public NameModel FatherName { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public NameModel FatherName { get; set; } = new(); | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public NameModel MotherName { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public NameModel MotherName { get; set; } = new(); | ||||
|  | ||||
|         [Required] | ||||
|         [StringLength(50, MinimumLength = 1)] | ||||
|         public string JobTitle { get; set; } = default!; | ||||
|     [Required] | ||||
|     [StringLength(50, MinimumLength = 1)] | ||||
|     public string JobTitle { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public PlaceOfWorkModel PlaceOfWork { get; set; } = new(); | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public PlaceOfWorkModel PlaceOfWork { get; set; } = new(); | ||||
|  | ||||
|         public bool IsNonResident { get; set; } | ||||
|     } | ||||
| } | ||||
|     public bool IsNonResident { get; set; } | ||||
| } | ||||
| @@ -1,13 +1,12 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using VisaApiClient; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models; | ||||
|  | ||||
| /// Model of request with attributes required for validation to work | ||||
| public class RegisterRequestModel | ||||
| { | ||||
|     /// Model of request with attributes required for validation to work | ||||
|     public class RegisterRequestModel | ||||
|     { | ||||
|         [Required] | ||||
|         [ValidateComplexType] | ||||
|         public AuthData AuthData { get; set; } = new AuthData(); | ||||
|     } | ||||
| } | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
|     public AuthData AuthData { get; set; } = new AuthData(); | ||||
| } | ||||
| @@ -1,12 +1,12 @@ | ||||
| using FluentValidation; | ||||
| using VisaApiClient; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Auth | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Auth; | ||||
|  | ||||
| public class ChangeUserAuthDataRequestValidator : AbstractValidator<ChangeUserAuthDataRequest> | ||||
| { | ||||
|     public class ChangeUserAuthDataRequestValidator : AbstractValidator<ChangeUserAuthDataRequest> | ||||
|     public ChangeUserAuthDataRequestValidator() | ||||
|     { | ||||
|         public ChangeUserAuthDataRequestValidator() | ||||
|         { | ||||
|             RuleFor(r => r.NewAuthData) | ||||
|                 .NotEmpty(); | ||||
|  | ||||
| @@ -17,5 +17,4 @@ namespace BlazorWebAssemblyVisaApiClient.Validation.Auth | ||||
|                 .MaximumLength(ConfigurationConstraints.EmailLength) | ||||
|                 .WithMessage($"Email address length must be less than {ConfigurationConstraints.EmailLength}"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -1,38 +1,37 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using VisaApiClient; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models; | ||||
|  | ||||
| /// Model for request for data annotations validation to work | ||||
| public class VisaApplicationCreateRequestModel | ||||
| { | ||||
|     /// Model for request for data annotations validation to work | ||||
|     public class VisaApplicationCreateRequestModel | ||||
|     { | ||||
|         [ValidateComplexType] | ||||
|         public ReentryPermitModel? ReentryPermit { get; set; } = default!; | ||||
|     [ValidateComplexType] | ||||
|     public ReentryPermitModel? ReentryPermit { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         [MaxLength(ConfigurationConstraints.CountryNameLength)] | ||||
|         public string DestinationCountry { get; set; } = default!; | ||||
|     [Required] | ||||
|     [MaxLength(ConfigurationConstraints.CountryNameLength)] | ||||
|     public string DestinationCountry { get; set; } = default!; | ||||
|  | ||||
|         [Required] | ||||
|         public VisaCategory VisaCategory { get; set; } | ||||
|     [Required] | ||||
|     public VisaCategory VisaCategory { get; set; } | ||||
|  | ||||
|         [Required] | ||||
|         public bool IsForGroup { get; set; } | ||||
|     [Required] | ||||
|     public bool IsForGroup { get; set; } | ||||
|  | ||||
|         [Required] | ||||
|         public RequestedNumberOfEntries RequestedNumberOfEntries { get; set; } | ||||
|     [Required] | ||||
|     public RequestedNumberOfEntries RequestedNumberOfEntries { get; set; } | ||||
|  | ||||
|         [Required] | ||||
|         [Range(0, ConfigurationConstraints.MaxValidDays)] | ||||
|         public int ValidDaysRequested { get; set; } | ||||
|     [Required] | ||||
|     [Range(0, ConfigurationConstraints.MaxValidDays)] | ||||
|     public int ValidDaysRequested { get; set; } | ||||
|  | ||||
|         [ValidateComplexType] | ||||
|         public List<PastVisaModel> PastVisas { get; set; } = []; | ||||
|     [ValidateComplexType] | ||||
|     public List<PastVisaModel> PastVisas { get; set; } = []; | ||||
|  | ||||
|         [ValidateComplexType] | ||||
|         public PermissionToDestCountryModel? PermissionToDestCountry { get; set; } = default!; | ||||
|     [ValidateComplexType] | ||||
|     public PermissionToDestCountryModel? PermissionToDestCountry { get; set; } = default!; | ||||
|  | ||||
|         [ValidateComplexType] | ||||
|         public List<PastVisitModel> PastVisits { get; set; } = []; | ||||
|     } | ||||
| } | ||||
|     [ValidateComplexType] | ||||
|     public List<PastVisitModel> PastVisits { get; set; } = []; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user