Removed location entities, fixed configurations and controllers' comments
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| using Domains; | ||||
| using Domains.ApplicantDomain; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.Applicants.Configuration; | ||||
| @@ -9,15 +8,20 @@ public static class AddressConfiguration<T> where T : class, IEntity | ||||
| { | ||||
|     public static void Configure(OwnedNavigationBuilder<T, Address> entity) | ||||
|     { | ||||
|         entity.HasOne(a => a.Country).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|         entity.HasOne(a => a.City).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|  | ||||
|         entity.Property(p => p.Street) | ||||
|         entity.Property(a => a.Country) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(100); | ||||
|             .HasMaxLength(ConfigurationConstraints.CountryNameLength); | ||||
|  | ||||
|         entity.Property(p => p.Building) | ||||
|         entity.Property(a => a.City) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(10); | ||||
|             .HasMaxLength(ConfigurationConstraints.CityNameLength); | ||||
|  | ||||
|         entity.Property(a => a.Street) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(ConfigurationConstraints.StreetNameLength); | ||||
|  | ||||
|         entity.Property(a => a.Building) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(ConfigurationConstraints.BuildingNumberLength); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -9,21 +9,27 @@ public class ApplicantConfiguration : IEntityTypeConfiguration<Applicant> | ||||
| { | ||||
|     public void Configure(EntityTypeBuilder<Applicant> entity) | ||||
|     { | ||||
|         entity.OwnsOne(p => p.Name, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(p => p.FatherName, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(p => p.MotherName, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(p => p.Passport, PassportConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(a => a.Name, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(a => a.FatherName, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(a => a.MotherName, NameConfiguration<Applicant>.Configure); | ||||
|         entity.OwnsOne(a => a.Passport, PassportConfiguration<Applicant>.Configure); | ||||
|  | ||||
|         entity.HasOne(a => a.CityOfBirth).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|         entity.HasOne(a => a.CountryOfBirth).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|         entity.HasOne<User>().WithOne().HasForeignKey<Applicant>(a => a.UserId); | ||||
|  | ||||
|         entity.Property(p => p.Citizenship) | ||||
|         entity.Property(a => a.Citizenship) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(30); | ||||
|             .HasMaxLength(ConfigurationConstraints.CitizenshipLength); | ||||
|  | ||||
|         entity.Property(p => p.CitizenshipByBirth) | ||||
|         entity.Property(a => a.CitizenshipByBirth) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(30); | ||||
|             .HasMaxLength(ConfigurationConstraints.CitizenshipLength); | ||||
|  | ||||
|         entity.Property(a => a.CountryOfBirth) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(ConfigurationConstraints.CountryNameLength); | ||||
|  | ||||
|         entity.Property(a => a.CityOfBirth) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(ConfigurationConstraints.CityNameLength); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -10,14 +10,14 @@ public static class NameConfiguration<T> where T : class, IEntity | ||||
|     { | ||||
|         entity.Property(p => p.FirstName) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(50); | ||||
|             .HasMaxLength(ConfigurationConstraints.NameLength); | ||||
|  | ||||
|         entity.Property(p => p.Surname) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(50); | ||||
|             .HasMaxLength(ConfigurationConstraints.NameLength); | ||||
|  | ||||
|         entity.Property(p => p.Patronymic) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(50); | ||||
|             .HasMaxLength(ConfigurationConstraints.NameLength); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -10,10 +10,10 @@ public static class PassportConfiguration<T> where T : class, IEntity | ||||
|     { | ||||
|         entity.Property(p => p.Number) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(20); | ||||
|             .HasMaxLength(ConfigurationConstraints.PassportNumberLength); | ||||
|  | ||||
|         entity.Property(p => p.Issuer) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(200); | ||||
|             .HasMaxLength(ConfigurationConstraints.IssuerNameLength); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -12,10 +12,10 @@ public class PlaceOfWorkConfiguration : IEntityTypeConfiguration<PlaceOfWork> | ||||
|  | ||||
|         entity.Property(p => p.Name) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(200); | ||||
|             .HasMaxLength(ConfigurationConstraints.PlaceOfWorkNameLength); | ||||
|  | ||||
|         entity.Property(p => p.PhoneNum) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(20); | ||||
|             .HasMaxLength(ConfigurationConstraints.PhoneNumberLength); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -15,8 +15,6 @@ public sealed class ApplicantsRepository(IGenericReader reader, IGenericWriter w | ||||
|     protected override IQueryable<Applicant> LoadDomain() | ||||
|     { | ||||
|         return base.LoadDomain() | ||||
|             .Include(a => a.CountryOfBirth) | ||||
|             .Include(a => a.CityOfBirth) | ||||
|             .Include(a => a.PlaceOfWork); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user