Changed models, added Application layer models
This commit is contained in:
		| @@ -1,4 +1,5 @@ | |||||||
| using Domains.ApplicantDomain; | using ApplicationLayer.VisaApplication.Models; | ||||||
|  | using Domains.ApplicantDomain; | ||||||
| using Domains.VisaApplicationDomain; | using Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
| namespace ApplicationLayer.VisaApplication; | namespace ApplicationLayer.VisaApplication; | ||||||
| @@ -19,7 +20,7 @@ public record CreateVisaApplicationRequest( | |||||||
|     bool IsNonResident, |     bool IsNonResident, | ||||||
|     ReentryPermit ReentryPermit, |     ReentryPermit ReentryPermit, | ||||||
|     string JobTitle, |     string JobTitle, | ||||||
|     PlaceOfWork PlaceOfWork, |     PlaceOfWorkModel PlaceOfWork, | ||||||
|     string DestinationCountry, |     string DestinationCountry, | ||||||
|     VisaCategory VisaCategory, |     VisaCategory VisaCategory, | ||||||
|     bool IsForGroup, |     bool IsForGroup, | ||||||
| @@ -28,4 +29,4 @@ public record CreateVisaApplicationRequest( | |||||||
|     PastVisa[] PastVisas, |     PastVisa[] PastVisas, | ||||||
|     PermissionToDestCountry? PermissionToDestCountry, |     PermissionToDestCountry? PermissionToDestCountry, | ||||||
|     PastVisit[] PastVisits |     PastVisit[] PastVisits | ||||||
|     ); | ); | ||||||
|   | |||||||
| @@ -0,0 +1,16 @@ | |||||||
|  | namespace ApplicationLayer.VisaApplication.Models; | ||||||
|  |  | ||||||
|  | public class AddressModel | ||||||
|  | { | ||||||
|  |     /// Country part of address | ||||||
|  |     public string Country { get; set; } = null!; | ||||||
|  |  | ||||||
|  |     /// City part of address | ||||||
|  |     public string City { get; set; } = null!; | ||||||
|  |  | ||||||
|  |     /// Street part of address | ||||||
|  |     public string Street { get; set; } = null!; | ||||||
|  |  | ||||||
|  |     /// Building part of address | ||||||
|  |     public string Building { get; set; } = null!; | ||||||
|  | } | ||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | namespace ApplicationLayer.VisaApplication.Models; | ||||||
|  |  | ||||||
|  | public class PlaceOfWorkModel | ||||||
|  | { | ||||||
|  |     /// Name of hirer | ||||||
|  |     public string Name { get; set; } = null!; | ||||||
|  |  | ||||||
|  |     /// <see cref="AddressModel"/> of hirer | ||||||
|  |     public AddressModel Address { get; set; } = null!; | ||||||
|  |  | ||||||
|  |     /// Phone number of hirer | ||||||
|  |     public string PhoneNum { get; set; } = null!; | ||||||
|  | } | ||||||
| @@ -1,11 +1,11 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
|  |  | ||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | /// Model of address | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class Address | ||||||
| { | { | ||||||
|     /// Model of address |  | ||||||
|     /// <remarks>Owned</remarks> |  | ||||||
|     public class Address |  | ||||||
|     { |  | ||||||
|     /// Country part of address |     /// Country part of address | ||||||
|     public Country Country { get; set; } = null!; |     public Country Country { get; set; } = null!; | ||||||
|  |  | ||||||
| @@ -17,5 +17,4 @@ namespace Domains.ApplicantDomain | |||||||
|  |  | ||||||
|     /// Building part of address |     /// Building part of address | ||||||
|     public string Building { get; set; } = null!; |     public string Building { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,11 +1,11 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
| using Domains.VisaApplicationDomain; | using Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | /// Model of an applicant | ||||||
|  | public class Applicant : IEntity | ||||||
| { | { | ||||||
|     /// Model of an applicant |  | ||||||
|     public class Applicant : IEntity |  | ||||||
|     { |  | ||||||
|     /// Unique identifier of the <see cref="Applicant"/> |     /// Unique identifier of the <see cref="Applicant"/> | ||||||
|     public Guid Id { get; set; } |     public Guid Id { get; set; } | ||||||
|  |  | ||||||
| @@ -53,5 +53,4 @@ namespace Domains.ApplicantDomain | |||||||
|  |  | ||||||
|     /// List of <see cref="Applicant"/>'s applications |     /// List of <see cref="Applicant"/>'s applications | ||||||
|     public List<VisaApplication> VisaApplications { get; set; } = null!; |     public List<VisaApplication> VisaApplications { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,10 +1,9 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | public enum Gender | ||||||
| { | { | ||||||
|     public enum Gender |  | ||||||
|     { |  | ||||||
|     Unknown, |     Unknown, | ||||||
|     Male, |     Male, | ||||||
|     Female, |     Female, | ||||||
|     Turkish |     Turkish | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,11 +1,10 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | public enum MaritalStatus | ||||||
| { | { | ||||||
|     public enum MaritalStatus |  | ||||||
|     { |  | ||||||
|     Other, |     Other, | ||||||
|     Married, |     Married, | ||||||
|     Unmarried, |     Unmarried, | ||||||
|     Separated, |     Separated, | ||||||
|     WidowOrWidower |     WidowOrWidower | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,13 +1,12 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | /// Model of full name | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class Name | ||||||
| { | { | ||||||
|     /// Model of full name |  | ||||||
|     /// <remarks>Owned</remarks> |  | ||||||
|     public class Name |  | ||||||
|     { |  | ||||||
|     public string FirstName { get; set; } = null!; |     public string FirstName { get; set; } = null!; | ||||||
|  |  | ||||||
|     public string Surname { get; set; } = null!; |     public string Surname { get; set; } = null!; | ||||||
|  |  | ||||||
|     public string? Patronymic { get; set; } |     public string? Patronymic { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | /// Model of passport | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class Passport | ||||||
| { | { | ||||||
|     /// Model of passport |  | ||||||
|     /// <remarks>Owned</remarks> |  | ||||||
|     public class Passport |  | ||||||
|     { |  | ||||||
|     /// Number of <see cref="Passport"/> |     /// Number of <see cref="Passport"/> | ||||||
|     public string Number { get; set; } = null!; |     public string Number { get; set; } = null!; | ||||||
|  |  | ||||||
| @@ -15,5 +15,4 @@ | |||||||
|  |  | ||||||
|     /// Date when the <see cref="Passport"/> expires |     /// Date when the <see cref="Passport"/> expires | ||||||
|     public DateTime ExpirationDate { get; set; } |     public DateTime ExpirationDate { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
|  |  | ||||||
|  | public class PlaceOfWork : IEntity | ||||||
| { | { | ||||||
|     public class PlaceOfWork : IEntity |  | ||||||
|     { |  | ||||||
|     /// Unique identifier of <see cref="PlaceOfWork"/> |     /// Unique identifier of <see cref="PlaceOfWork"/> | ||||||
|     public Guid Id { get; private set; } = Guid.NewGuid(); |     public Guid Id { get; private set; } = Guid.NewGuid(); | ||||||
|  |  | ||||||
| @@ -13,5 +13,4 @@ | |||||||
|  |  | ||||||
|     /// Phone number of hirer |     /// Phone number of hirer | ||||||
|     public string PhoneNum { get; set; } = null!; |     public string PhoneNum { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,8 +1,7 @@ | |||||||
| namespace Domains | namespace Domains; | ||||||
|  |  | ||||||
|  | /// Interface that every entity should inherit from | ||||||
|  | public interface IEntity | ||||||
| { | { | ||||||
|     /// Interface that every entity should inherit from |  | ||||||
|     public interface IEntity |  | ||||||
|     { |  | ||||||
|     public Guid Id { get; } |     public Guid Id { get; } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| namespace Domains.LocationDomain | namespace Domains.LocationDomain; | ||||||
|  |  | ||||||
|  | /// Model of a city | ||||||
|  | public class City : IEntity | ||||||
| { | { | ||||||
|     /// Model of a city |  | ||||||
|     public class City : IEntity |  | ||||||
|     { |  | ||||||
|     /// Unique identifier of the <see cref="City"/> |     /// Unique identifier of the <see cref="City"/> | ||||||
|     public Guid Id { get; private set; } = Guid.NewGuid(); |     public Guid Id { get; private set; } = Guid.NewGuid(); | ||||||
|  |  | ||||||
| @@ -11,5 +11,4 @@ | |||||||
|  |  | ||||||
|     /// <see cref="LocationDomain.Country"/> in which the city is located |     /// <see cref="LocationDomain.Country"/> in which the city is located | ||||||
|     public Country Country { get; set; } = null!; |     public Country Country { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| namespace Domains.LocationDomain | namespace Domains.LocationDomain; | ||||||
|  |  | ||||||
|  | /// Model of a country | ||||||
|  | public class Country : IEntity | ||||||
| { | { | ||||||
|     /// Model of a country |  | ||||||
|     public class Country : IEntity |  | ||||||
|     { |  | ||||||
|     /// Unique identifier of the <see cref="Country"/> |     /// Unique identifier of the <see cref="Country"/> | ||||||
|     public Guid Id { get; private set; } = Guid.NewGuid(); |     public Guid Id { get; private set; } = Guid.NewGuid(); | ||||||
|  |  | ||||||
| @@ -14,5 +14,4 @@ | |||||||
|  |  | ||||||
|     /// List of <see cref="City"/> that country have |     /// List of <see cref="City"/> that country have | ||||||
|     public List<City> Cities { get; set; } = null!; |     public List<City> Cities { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,13 +1,11 @@ | |||||||
| using Domains.ApplicantDomain; | using Domains.ApplicantDomain; | ||||||
|  |  | ||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
|     /// Visa that <see cref="Applicant"/> already had |  | ||||||
|     public class PastVisa : IEntity |  | ||||||
|     { |  | ||||||
|         /// Unique identifier of <see cref="PastVisa"/> |  | ||||||
|         public Guid Id { get; private set; } = Guid.NewGuid(); |  | ||||||
|  |  | ||||||
|  | /// Visa that <see cref="Applicant"/> already had | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class PastVisa | ||||||
|  | { | ||||||
|     /// Date of issue |     /// Date of issue | ||||||
|     public DateTime IssueDate { get; set; } |     public DateTime IssueDate { get; set; } | ||||||
|  |  | ||||||
| @@ -16,5 +14,4 @@ namespace Domains.VisaApplicationDomain | |||||||
|  |  | ||||||
|     /// Date when visa expires |     /// Date when visa expires | ||||||
|     public DateTime ExpirationDate { get; set; } |     public DateTime ExpirationDate { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,17 +1,14 @@ | |||||||
| using Domains.ApplicantDomain; | using Domains.ApplicantDomain; | ||||||
|  |  | ||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
|     /// Visit in a Schengen country that <see cref="Applicant"/> already had |  | ||||||
|     public class PastVisit : IEntity |  | ||||||
|     { |  | ||||||
|         /// Unique identifier of <see cref="PastVisit"/> |  | ||||||
|         public Guid Id { get; private set; } = Guid.NewGuid(); |  | ||||||
|  |  | ||||||
|  | /// Visit in a Schengen country that <see cref="Applicant"/> already had | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class PastVisit | ||||||
|  | { | ||||||
|     /// First day of <see cref="PastVisit"/> |     /// First day of <see cref="PastVisit"/> | ||||||
|     public DateTime StartDate { get; set; } |     public DateTime StartDate { get; set; } | ||||||
|  |  | ||||||
|     /// Last day of <see cref="PastVisit"/> |     /// Last day of <see cref="PastVisit"/> | ||||||
|     public DateTime EndDate { get; set; } |     public DateTime EndDate { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,13 +1,12 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
|  | /// Permission to enter the destination country | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class PermissionToDestCountry | ||||||
| { | { | ||||||
|     /// Permission to enter the destination country |  | ||||||
|     /// <remarks>Owned</remarks> |  | ||||||
|     public class PermissionToDestCountry |  | ||||||
|     { |  | ||||||
|     /// Date when <see cref="PermissionToDestCountry"/> expires |     /// Date when <see cref="PermissionToDestCountry"/> expires | ||||||
|     public DateTime ExpirationDate { get; set; } |     public DateTime ExpirationDate { get; set; } | ||||||
|  |  | ||||||
|     /// Issuing authority |     /// Issuing authority | ||||||
|     public string Issuer { get; set; } = null!; |     public string Issuer { get; set; } = null!; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,13 +1,12 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
|  | /// Permission to enter a country the issuer wants to come from | ||||||
|  | /// <remarks>Owned</remarks> | ||||||
|  | public class ReentryPermit | ||||||
| { | { | ||||||
|     /// Permission to enter a country the issuer wants to come from |  | ||||||
|     /// <remarks>Owned</remarks> |  | ||||||
|     public class ReentryPermit |  | ||||||
|     { |  | ||||||
|     /// Number of <see cref="ReentryPermit"/> |     /// Number of <see cref="ReentryPermit"/> | ||||||
|     public string Number { get; set; } = null!; |     public string Number { get; set; } = null!; | ||||||
|  |  | ||||||
|     /// Date when <see cref="ReentryPermit"/> expires |     /// Date when <see cref="ReentryPermit"/> expires | ||||||
|     public DateTime ExpirationDate { get; set; } |     public DateTime ExpirationDate { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,10 +1,9 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
|  | /// Requested number of entries | ||||||
|  | public enum RequestedNumberOfEntries | ||||||
| { | { | ||||||
|     /// Requested number of entries |  | ||||||
|     public enum RequestedNumberOfEntries |  | ||||||
|     { |  | ||||||
|     Many, |     Many, | ||||||
|     One, |     One, | ||||||
|     Two |     Two | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,11 +1,11 @@ | |||||||
| using Domains.ApplicantDomain; | using Domains.ApplicantDomain; | ||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
|  |  | ||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
|  | /// Model of visit request | ||||||
|  | public class VisaApplication : IEntity | ||||||
| { | { | ||||||
|     /// Model of visit request |  | ||||||
|     public class VisaApplication : IEntity |  | ||||||
|     { |  | ||||||
|     /// Unique identifier of <see cref="VisaApplication"/> |     /// Unique identifier of <see cref="VisaApplication"/> | ||||||
|     public Guid Id { get; private set; } = Guid.NewGuid(); |     public Guid Id { get; private set; } = Guid.NewGuid(); | ||||||
|  |  | ||||||
| @@ -47,5 +47,4 @@ namespace Domains.VisaApplicationDomain | |||||||
|  |  | ||||||
|     /// Valid days requested |     /// Valid days requested | ||||||
|     public int ValidDaysRequested { get; set; } |     public int ValidDaysRequested { get; set; } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,9 +1,8 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
|  | /// Category of visa | ||||||
|  | public enum VisaCategory | ||||||
| { | { | ||||||
|     /// Category of visa |  | ||||||
|     public enum VisaCategory |  | ||||||
|     { |  | ||||||
|     Transit, |     Transit, | ||||||
|     ShortDated |     ShortDated | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Configuration | namespace Infrastructure.Database.Applicants.Configuration; | ||||||
|  |  | ||||||
|  | public class AddressConfiguration : IEntityTypeConfiguration<Address> | ||||||
| { | { | ||||||
|     public class AddressConfiguration : IEntityTypeConfiguration<Address> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<Address> entity) |     public void Configure(EntityTypeBuilder<Address> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Street) |         entity.Property(p => p.Street) | ||||||
| @@ -15,5 +15,4 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(10); |             .HasMaxLength(10); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Configuration | namespace Infrastructure.Database.Applicants.Configuration; | ||||||
|  |  | ||||||
|  | public class ApplicantConfiguration : IEntityTypeConfiguration<Applicant> | ||||||
| { | { | ||||||
|     public class ApplicantConfiguration : IEntityTypeConfiguration<Applicant> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<Applicant> entity) |     public void Configure(EntityTypeBuilder<Applicant> entity) | ||||||
|     { |     { | ||||||
|         entity.ToTable("Applicants"); |         entity.ToTable("Applicants"); | ||||||
| @@ -23,5 +23,4 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(30); |             .HasMaxLength(30); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Configuration | namespace Infrastructure.Database.Applicants.Configuration; | ||||||
|  |  | ||||||
|  | public class NameConfiguration : IEntityTypeConfiguration<Name> | ||||||
| { | { | ||||||
|     public class NameConfiguration : IEntityTypeConfiguration<Name> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<Name> entity) |     public void Configure(EntityTypeBuilder<Name> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.FirstName) |         entity.Property(p => p.FirstName) | ||||||
| @@ -20,5 +20,4 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(50); |             .HasMaxLength(50); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Configuration | namespace Infrastructure.Database.Applicants.Configuration; | ||||||
|  |  | ||||||
|  | public class PassportConfiguration : IEntityTypeConfiguration<Passport> | ||||||
| { | { | ||||||
|     public class PassportConfiguration : IEntityTypeConfiguration<Passport> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<Passport> entity) |     public void Configure(EntityTypeBuilder<Passport> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Number) |         entity.Property(p => p.Number) | ||||||
| @@ -16,5 +16,4 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(200); |             .HasMaxLength(200); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Configuration | namespace Infrastructure.Database.Applicants.Configuration; | ||||||
|  |  | ||||||
|  | public class PlaceOfWorkConfiguration : IEntityTypeConfiguration<PlaceOfWork> | ||||||
| { | { | ||||||
|     public class PlaceOfWorkConfiguration : IEntityTypeConfiguration<PlaceOfWork> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<PlaceOfWork> entity) |     public void Configure(EntityTypeBuilder<PlaceOfWork> entity) | ||||||
|     { |     { | ||||||
|         entity.OwnsOne(p => p.Address); |         entity.OwnsOne(p => p.Address); | ||||||
| @@ -18,5 +18,4 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(20); |             .HasMaxLength(20); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,15 +2,15 @@ | |||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Repositories | namespace Infrastructure.Database.Applicants.Repositories; | ||||||
| { |  | ||||||
|     /// Repository pattern for <see cref="Applicant"/> | /// Repository pattern for <see cref="Applicant"/> | ||||||
|     /// <param name="reader"><inheritdoc cref="IGenericReader"/></param> | /// <param name="reader"><inheritdoc cref="IGenericReader"/></param> | ||||||
|     /// <param name="writer"><inheritdoc cref="IGenericWriter"/></param> | /// <param name="writer"><inheritdoc cref="IGenericWriter"/></param> | ||||||
|     /// <param name="unitOfWork"><inheritdoc cref="IUnitOfWork"/></param> | /// <param name="unitOfWork"><inheritdoc cref="IUnitOfWork"/></param> | ||||||
|     public sealed class ApplicantsRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | public sealed class ApplicantsRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||||
|     : GenericRepository<Applicant>(reader, writer, unitOfWork), IApplicantsRepository |     : GenericRepository<Applicant>(reader, writer, unitOfWork), IApplicantsRepository | ||||||
|     { | { | ||||||
|     protected override IQueryable<Applicant> LoadDomain() |     protected override IQueryable<Applicant> LoadDomain() | ||||||
|     { |     { | ||||||
|         return base.LoadDomain() |         return base.LoadDomain() | ||||||
| @@ -18,5 +18,4 @@ namespace Infrastructure.Database.Applicants.Repositories | |||||||
|             .Include(a => a.CityOfBirth) |             .Include(a => a.CityOfBirth) | ||||||
|             .Include(a => a.PlaceOfWork); |             .Include(a => a.PlaceOfWork); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,8 +1,7 @@ | |||||||
| using Domains.ApplicantDomain; | using Domains.ApplicantDomain; | ||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Applicants.Repositories | namespace Infrastructure.Database.Applicants.Repositories; | ||||||
| { |  | ||||||
|     /// Repository pattern for <see cref="Applicant"/> | /// Repository pattern for <see cref="Applicant"/> | ||||||
|     public interface IApplicantsRepository : IGenericRepository<Applicant> { } | public interface IApplicantsRepository : IGenericRepository<Applicant> { } | ||||||
| } |  | ||||||
| @@ -2,11 +2,11 @@ | |||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database | namespace Infrastructure.Database; | ||||||
| { |  | ||||||
|     public class DbContext(DbContextOptions<DbContext> opts) | public class DbContext(DbContextOptions<DbContext> opts) | ||||||
|     : Microsoft.EntityFrameworkCore.DbContext(opts), IGenericWriter, IGenericReader, IUnitOfWork |     : Microsoft.EntityFrameworkCore.DbContext(opts), IGenericWriter, IGenericReader, IUnitOfWork | ||||||
|     { | { | ||||||
|     protected override void OnModelCreating(ModelBuilder modelBuilder) |     protected override void OnModelCreating(ModelBuilder modelBuilder) | ||||||
|     { |     { | ||||||
|         modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); |         modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); | ||||||
| @@ -36,5 +36,4 @@ namespace Infrastructure.Database | |||||||
|     { |     { | ||||||
|         await SaveChangesAsync(cancellationToken); |         await SaveChangesAsync(cancellationToken); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,10 +1,9 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.GeneralExceptions | namespace Infrastructure.Database.GeneralExceptions; | ||||||
| { |  | ||||||
|     /// Exception to throw when entity with specific id not found | /// Exception to throw when entity with specific id not found | ||||||
|     /// <param name="id">Identifier of entity</param> | /// <param name="id">Identifier of entity</param> | ||||||
|     /// <typeparam name="T">Not found entity type</typeparam> | /// <typeparam name="T">Not found entity type</typeparam> | ||||||
|     public class EntityNotFoundException<T>(Guid id) : Exception($"Entity {typeof(T).Name} with id '{id}' not found") | public class EntityNotFoundException<T>(Guid id) : Exception($"Entity {typeof(T).Name} with id '{id}' not found") | ||||||
|     where T : class, IEntity; |     where T : class, IEntity; | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,16 +2,16 @@ | |||||||
| using Infrastructure.Database.GeneralExceptions; | using Infrastructure.Database.GeneralExceptions; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
| { |  | ||||||
|     /// Generic repository pattern | /// Generic repository pattern | ||||||
|     /// <param name="writer"><inheritdoc cref="IGenericWriter"/></param> | /// <param name="writer"><inheritdoc cref="IGenericWriter"/></param> | ||||||
|     /// <param name="unitOfWork"><inheritdoc cref="IUnitOfWork"/></param> | /// <param name="unitOfWork"><inheritdoc cref="IUnitOfWork"/></param> | ||||||
|     /// <typeparam name="T">Type of entity</typeparam> | /// <typeparam name="T">Type of entity</typeparam> | ||||||
|     /// <remarks>Should be inherited to create typed repositories</remarks> | /// <remarks>Should be inherited to create typed repositories</remarks> | ||||||
|     public abstract class GenericRepository<T>(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) : IGenericRepository<T> | public abstract class GenericRepository<T>(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) : IGenericRepository<T> | ||||||
|     where T : class, IEntity |     where T : class, IEntity | ||||||
|     { | { | ||||||
|     /// <inheritdoc cref="IGenericRepository{T}.GetAllAsync"/> |     /// <inheritdoc cref="IGenericRepository{T}.GetAllAsync"/> | ||||||
|     public async Task<List<T>> GetAllAsync(CancellationToken cancellationToken) |     public async Task<List<T>> GetAllAsync(CancellationToken cancellationToken) | ||||||
|         => await LoadDomain().ToListAsync(cancellationToken); |         => await LoadDomain().ToListAsync(cancellationToken); | ||||||
| @@ -49,5 +49,4 @@ namespace Infrastructure.Database.Generic | |||||||
|     { |     { | ||||||
|         return reader.GetAll<T>(); |         return reader.GetAll<T>(); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,12 +1,11 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
|  | /// Reads from data storage | ||||||
|  | public interface IGenericReader | ||||||
| { | { | ||||||
|     /// Reads from data storage |  | ||||||
|     public interface IGenericReader |  | ||||||
|     { |  | ||||||
|     /// Get all entities of type T stored in storage |     /// Get all entities of type T stored in storage | ||||||
|     /// <typeparam name="T">Entity type to seek in storage</typeparam> |     /// <typeparam name="T">Entity type to seek in storage</typeparam> | ||||||
|     IQueryable<T> GetAll<T>() where T : class, IEntity; |     IQueryable<T> GetAll<T>() where T : class, IEntity; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,13 +1,13 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
|  | /// <summary> | ||||||
|  | /// Generic repository pattern | ||||||
|  | /// </summary> | ||||||
|  | /// <typeparam name="T">Entity type</typeparam> | ||||||
|  | public interface IGenericRepository<T> where T : class, IEntity | ||||||
| { | { | ||||||
|     /// <summary> |  | ||||||
|     /// Generic repository pattern |  | ||||||
|     /// </summary> |  | ||||||
|     /// <typeparam name="T">Entity type</typeparam> |  | ||||||
|     public interface IGenericRepository<T> where T : class, IEntity |  | ||||||
|     { |  | ||||||
|     /// Get all entities from data storage |     /// Get all entities from data storage | ||||||
|     Task<List<T>> GetAllAsync(CancellationToken cancellationToken); |     Task<List<T>> GetAllAsync(CancellationToken cancellationToken); | ||||||
|  |  | ||||||
| @@ -33,5 +33,4 @@ namespace Infrastructure.Database.Generic | |||||||
|  |  | ||||||
|     /// Save changes in storage |     /// Save changes in storage | ||||||
|     Task SaveAsync(CancellationToken cancellationToken); |     Task SaveAsync(CancellationToken cancellationToken); | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,11 +1,11 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
|  | /// Writes data to data storage | ||||||
|  | /// <remarks><see cref="IUnitOfWork"/> should be used to save changes</remarks> | ||||||
|  | public interface IGenericWriter | ||||||
| { | { | ||||||
|     /// Writes data to data storage |  | ||||||
|     /// <remarks><see cref="IUnitOfWork"/> should be used to save changes</remarks> |  | ||||||
|     public interface IGenericWriter |  | ||||||
|     { |  | ||||||
|     /// Add entity to data storage |     /// Add entity to data storage | ||||||
|     /// <param name="entity">Entity to add</param> |     /// <param name="entity">Entity to add</param> | ||||||
|     /// <param name="cancellationToken">Cancellation Token</param> |     /// <param name="cancellationToken">Cancellation Token</param> | ||||||
| @@ -21,5 +21,4 @@ namespace Infrastructure.Database.Generic | |||||||
|     /// <param name="entity">Entity to remove</param> |     /// <param name="entity">Entity to remove</param> | ||||||
|     /// <typeparam name="T">Entity type</typeparam> |     /// <typeparam name="T">Entity type</typeparam> | ||||||
|     void Remove<T>(T entity) where T : class, IEntity; |     void Remove<T>(T entity) where T : class, IEntity; | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,9 +1,8 @@ | |||||||
| namespace Infrastructure.Database | namespace Infrastructure.Database; | ||||||
|  |  | ||||||
|  | public interface IUnitOfWork | ||||||
| { | { | ||||||
|     public interface IUnitOfWork |  | ||||||
|     { |  | ||||||
|     /// Saves changes in data storage |     /// Saves changes in data storage | ||||||
|     /// <param name="cancellationToken">Cancellation Token</param> |     /// <param name="cancellationToken">Cancellation Token</param> | ||||||
|     Task SaveAsync(CancellationToken cancellationToken); |     Task SaveAsync(CancellationToken cancellationToken); | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,15 +2,14 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Configuration | namespace Infrastructure.Database.Locations.Configuration; | ||||||
|  |  | ||||||
|  | public class CityConfiguration : IEntityTypeConfiguration<City> | ||||||
| { | { | ||||||
|     public class CityConfiguration : IEntityTypeConfiguration<City> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<City> entity) |     public void Configure(EntityTypeBuilder<City> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Name) |         entity.Property(p => p.Name) | ||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,15 +2,14 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Configuration | namespace Infrastructure.Database.Locations.Configuration; | ||||||
|  |  | ||||||
|  | public class CountryConfiguration : IEntityTypeConfiguration<Country> | ||||||
| { | { | ||||||
|     public class CountryConfiguration : IEntityTypeConfiguration<Country> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<Country> entity) |     public void Configure(EntityTypeBuilder<Country> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Name) |         entity.Property(p => p.Name) | ||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,14 +2,13 @@ | |||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Repositories.Cities | namespace Infrastructure.Database.Locations.Repositories.Cities; | ||||||
| { |  | ||||||
|     public sealed class CitiesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | public sealed class CitiesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||||
|     : GenericRepository<City>(reader, writer, unitOfWork), ICitiesRepository |     : GenericRepository<City>(reader, writer, unitOfWork), ICitiesRepository | ||||||
|     { | { | ||||||
|     protected override IQueryable<City> LoadDomain() |     protected override IQueryable<City> LoadDomain() | ||||||
|     { |     { | ||||||
|         return base.LoadDomain().Include(c => c.Country); |         return base.LoadDomain().Include(c => c.Country); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,7 +1,6 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Repositories.Cities | namespace Infrastructure.Database.Locations.Repositories.Cities; | ||||||
| { |  | ||||||
|     public interface ICitiesRepository : IGenericRepository<City> { } | public interface ICitiesRepository : IGenericRepository<City> { } | ||||||
| } |  | ||||||
| @@ -2,14 +2,13 @@ | |||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Repositories.Countries | namespace Infrastructure.Database.Locations.Repositories.Countries; | ||||||
| { |  | ||||||
|     public sealed class CountriesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | public sealed class CountriesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||||
|     : GenericRepository<Country>(reader, writer, unitOfWork), ICountriesRepository |     : GenericRepository<Country>(reader, writer, unitOfWork), ICountriesRepository | ||||||
|     { | { | ||||||
|     protected override IQueryable<Country> LoadDomain() |     protected override IQueryable<Country> LoadDomain() | ||||||
|     { |     { | ||||||
|         return base.LoadDomain().Include(c => c.Cities); |         return base.LoadDomain().Include(c => c.Cities); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,7 +1,6 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Locations.Repositories.Countries | namespace Infrastructure.Database.Locations.Repositories.Countries; | ||||||
| { |  | ||||||
|     public interface ICountriesRepository : IGenericRepository<Country> { } | public interface ICountriesRepository : IGenericRepository<Country> { } | ||||||
| } |  | ||||||
| @@ -2,15 +2,14 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Configuration | namespace Infrastructure.Database.VisaApplications.Configuration; | ||||||
|  |  | ||||||
|  | public class PastVisaConfiguration : IEntityTypeConfiguration<PastVisa> | ||||||
| { | { | ||||||
|     public class PastVisaConfiguration : IEntityTypeConfiguration<PastVisa> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<PastVisa> entity) |     public void Configure(EntityTypeBuilder<PastVisa> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Name) |         entity.Property(p => p.Name) | ||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,15 +2,14 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Configuration | namespace Infrastructure.Database.VisaApplications.Configuration; | ||||||
|  |  | ||||||
|  | public class PermissionToDestCountryConfiguration : IEntityTypeConfiguration<PermissionToDestCountry> | ||||||
| { | { | ||||||
|     public class PermissionToDestCountryConfiguration : IEntityTypeConfiguration<PermissionToDestCountry> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<PermissionToDestCountry> entity) |     public void Configure(EntityTypeBuilder<PermissionToDestCountry> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Issuer) |         entity.Property(p => p.Issuer) | ||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(200); |             .HasMaxLength(200); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,15 +2,14 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Configuration | namespace Infrastructure.Database.VisaApplications.Configuration; | ||||||
|  |  | ||||||
|  | public class ReentryPermitConfiguration : IEntityTypeConfiguration<ReentryPermit> | ||||||
| { | { | ||||||
|     public class ReentryPermitConfiguration : IEntityTypeConfiguration<ReentryPermit> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<ReentryPermit> entity) |     public void Configure(EntityTypeBuilder<ReentryPermit> entity) | ||||||
|     { |     { | ||||||
|         entity.Property(p => p.Number) |         entity.Property(p => p.Number) | ||||||
|             .IsUnicode(false) |             .IsUnicode(false) | ||||||
|             .HasMaxLength(25); |             .HasMaxLength(25); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -2,10 +2,10 @@ | |||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Configuration | namespace Infrastructure.Database.VisaApplications.Configuration; | ||||||
|  |  | ||||||
|  | public class VisaApplicationConfiguration : IEntityTypeConfiguration<VisaApplication> | ||||||
| { | { | ||||||
|     public class VisaApplicationConfiguration : IEntityTypeConfiguration<VisaApplication> |  | ||||||
|     { |  | ||||||
|     public void Configure(EntityTypeBuilder<VisaApplication> entity) |     public void Configure(EntityTypeBuilder<VisaApplication> entity) | ||||||
|     { |     { | ||||||
|         entity.ToTable("VisaApplications"); |         entity.ToTable("VisaApplications"); | ||||||
| @@ -17,6 +17,7 @@ namespace Infrastructure.Database.VisaApplications.Configuration | |||||||
|  |  | ||||||
|         entity.OwnsOne(p => p.ReentryPermit); |         entity.OwnsOne(p => p.ReentryPermit); | ||||||
|         entity.OwnsOne(p => p.PermissionToDestCountry); |         entity.OwnsOne(p => p.PermissionToDestCountry); | ||||||
|         } |         entity.OwnsMany(p => p.PastVisits).ToTable("PastVisits"); | ||||||
|  |         entity.OwnsMany(p => p.PastVisas).ToTable("PastVisas"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| using Domains.VisaApplicationDomain; | using Domains.VisaApplicationDomain; | ||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Repositories | namespace Infrastructure.Database.VisaApplications.Repositories; | ||||||
| { |  | ||||||
|     public interface IVisaApplicationsRepository : IGenericRepository<VisaApplication> { } | public interface IVisaApplicationsRepository : IGenericRepository<VisaApplication> { } | ||||||
| } |  | ||||||
| @@ -2,11 +2,11 @@ | |||||||
| using Infrastructure.Database.Generic; | using Infrastructure.Database.Generic; | ||||||
| using Microsoft.EntityFrameworkCore; | using Microsoft.EntityFrameworkCore; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.VisaApplications.Repositories | namespace Infrastructure.Database.VisaApplications.Repositories; | ||||||
| { |  | ||||||
|     public sealed class VisaApplicationsRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | public sealed class VisaApplicationsRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||||
|     : GenericRepository<VisaApplication>(reader, writer, unitOfWork), IVisaApplicationsRepository |     : GenericRepository<VisaApplication>(reader, writer, unitOfWork), IVisaApplicationsRepository | ||||||
|     { | { | ||||||
|     protected override IQueryable<VisaApplication> LoadDomain() |     protected override IQueryable<VisaApplication> LoadDomain() | ||||||
|     { |     { | ||||||
|         return base.LoadDomain() |         return base.LoadDomain() | ||||||
| @@ -14,5 +14,4 @@ namespace Infrastructure.Database.VisaApplications.Repositories | |||||||
|             .Include(a => a.PastVisas) |             .Include(a => a.PastVisas) | ||||||
|             .Include(a => a.PastVisits); |             .Include(a => a.PastVisits); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -8,11 +8,11 @@ using Microsoft.EntityFrameworkCore; | |||||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||||
| using DbContext = Infrastructure.Database.DbContext; | using DbContext = Infrastructure.Database.DbContext; | ||||||
|  |  | ||||||
| namespace Infrastructure | namespace Infrastructure; | ||||||
|  |  | ||||||
|  | /// Provides methods to add services to DI-container | ||||||
|  | public static class DependencyInjection | ||||||
| { | { | ||||||
|     /// Provides methods to add services to DI-container |  | ||||||
|     public static class DependencyInjection |  | ||||||
|     { |  | ||||||
|     /// Add services needed for Infrastructure layer |     /// Add services needed for Infrastructure layer | ||||||
|     public static IServiceCollection AddInfrastructure(this IServiceCollection services) |     public static IServiceCollection AddInfrastructure(this IServiceCollection services) | ||||||
|     { |     { | ||||||
| @@ -31,5 +31,4 @@ namespace Infrastructure | |||||||
|  |  | ||||||
|         return services; |         return services; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,11 +1,11 @@ | |||||||
| using System.Reflection; | using System.Reflection; | ||||||
| using Infrastructure; | using Infrastructure; | ||||||
|  |  | ||||||
| namespace SchengenVisaApi | namespace SchengenVisaApi; | ||||||
|  |  | ||||||
|  | /// Provides methods to add services to DI-container | ||||||
|  | public static class DependencyInjection | ||||||
| { | { | ||||||
|     /// Provides methods to add services to DI-container |  | ||||||
|     public static class DependencyInjection |  | ||||||
|     { |  | ||||||
|     /// Add needed services |     /// Add needed services | ||||||
|     public static IServiceCollection RegisterServices(this IServiceCollection services) |     public static IServiceCollection RegisterServices(this IServiceCollection services) | ||||||
|     { |     { | ||||||
| @@ -27,5 +27,4 @@ namespace SchengenVisaApi | |||||||
|             options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename)); |             options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename)); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
| @@ -1,5 +1,4 @@ | |||||||
| namespace SchengenVisaApi; | namespace SchengenVisaApi; | ||||||
|  |  | ||||||
| #pragma warning disable CS1591 | #pragma warning disable CS1591 | ||||||
| public class Program | public class Program | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| namespace SchengenVisaApi | namespace SchengenVisaApi; | ||||||
|  |  | ||||||
|  | /// Provides methods for configuring middleware | ||||||
|  | public static class PipelineRequest | ||||||
| { | { | ||||||
|     /// Provides methods for configuring middleware |  | ||||||
|     public static class PipelineRequest |  | ||||||
|     { |  | ||||||
|     /// Configure middleware |     /// Configure middleware | ||||||
|     public static WebApplication ConfigurePipelineRequest(this WebApplication app) |     public static WebApplication ConfigurePipelineRequest(this WebApplication app) | ||||||
|     { |     { | ||||||
| @@ -15,5 +15,4 @@ | |||||||
|  |  | ||||||
|         return app; |         return app; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user