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, | ||||||
|   | |||||||
| @@ -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,7 +1,7 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
|  |  | ||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| /// Model of address | /// Model of address | ||||||
| /// <remarks>Owned</remarks> | /// <remarks>Owned</remarks> | ||||||
| public class Address | public class Address | ||||||
| @@ -18,4 +18,3 @@ namespace Domains.ApplicantDomain | |||||||
|     /// Building part of address |     /// Building part of address | ||||||
|     public string Building { get; set; } = null!; |     public string Building { get; set; } = null!; | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
| using Domains.VisaApplicationDomain; | using Domains.VisaApplicationDomain; | ||||||
|  |  | ||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| /// Model of an applicant | /// Model of an applicant | ||||||
| public class Applicant : IEntity | public class Applicant : IEntity | ||||||
| { | { | ||||||
| @@ -54,4 +54,3 @@ 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,5 +1,5 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| public enum Gender | public enum Gender | ||||||
| { | { | ||||||
|     Unknown, |     Unknown, | ||||||
| @@ -7,4 +7,3 @@ | |||||||
|     Female, |     Female, | ||||||
|     Turkish |     Turkish | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| public enum MaritalStatus | public enum MaritalStatus | ||||||
| { | { | ||||||
|     Other, |     Other, | ||||||
| @@ -8,4 +8,3 @@ | |||||||
|     Separated, |     Separated, | ||||||
|     WidowOrWidower |     WidowOrWidower | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| /// Model of full name | /// Model of full name | ||||||
| /// <remarks>Owned</remarks> | /// <remarks>Owned</remarks> | ||||||
| public class Name | public class Name | ||||||
| @@ -10,4 +10,3 @@ | |||||||
|  |  | ||||||
|     public string? Patronymic { get; set; } |     public string? Patronymic { get; set; } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.ApplicantDomain | namespace Domains.ApplicantDomain; | ||||||
| { |  | ||||||
| /// Model of passport | /// Model of passport | ||||||
| /// <remarks>Owned</remarks> | /// <remarks>Owned</remarks> | ||||||
| public class Passport | public class Passport | ||||||
| @@ -16,4 +16,3 @@ | |||||||
|     /// 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,5 +1,5 @@ | |||||||
| 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"/> | ||||||
| @@ -14,4 +14,3 @@ | |||||||
|     /// 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 | /// Interface that every entity should inherit from | ||||||
| public interface IEntity | public interface IEntity | ||||||
| { | { | ||||||
|     public Guid Id { get; } |     public Guid Id { get; } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.LocationDomain | namespace Domains.LocationDomain; | ||||||
| { |  | ||||||
| /// Model of a city | /// Model of a city | ||||||
| public class City : IEntity | public class City : IEntity | ||||||
| { | { | ||||||
| @@ -12,4 +12,3 @@ | |||||||
|     /// <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,5 +1,5 @@ | |||||||
| namespace Domains.LocationDomain | namespace Domains.LocationDomain; | ||||||
| { |  | ||||||
| /// Model of a country | /// Model of a country | ||||||
| public class Country : IEntity | public class Country : IEntity | ||||||
| { | { | ||||||
| @@ -15,4 +15,3 @@ | |||||||
|     /// 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; } | ||||||
|  |  | ||||||
| @@ -17,4 +15,3 @@ 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,5 +1,5 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
| /// Permission to enter the destination country | /// Permission to enter the destination country | ||||||
| /// <remarks>Owned</remarks> | /// <remarks>Owned</remarks> | ||||||
| public class PermissionToDestCountry | public class PermissionToDestCountry | ||||||
| @@ -10,4 +10,3 @@ | |||||||
|     /// Issuing authority |     /// Issuing authority | ||||||
|     public string Issuer { get; set; } = null!; |     public string Issuer { get; set; } = null!; | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
| /// Permission to enter a country the issuer wants to come from | /// Permission to enter a country the issuer wants to come from | ||||||
| /// <remarks>Owned</remarks> | /// <remarks>Owned</remarks> | ||||||
| public class ReentryPermit | public class ReentryPermit | ||||||
| @@ -10,4 +10,3 @@ | |||||||
|     /// Date when <see cref="ReentryPermit"/> expires |     /// Date when <see cref="ReentryPermit"/> expires | ||||||
|     public DateTime ExpirationDate { get; set; } |     public DateTime ExpirationDate { get; set; } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
| /// Requested number of entries | /// Requested number of entries | ||||||
| public enum RequestedNumberOfEntries | public enum RequestedNumberOfEntries | ||||||
| { | { | ||||||
| @@ -7,4 +7,3 @@ | |||||||
|     One, |     One, | ||||||
|     Two |     Two | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| using Domains.ApplicantDomain; | using Domains.ApplicantDomain; | ||||||
| using Domains.LocationDomain; | using Domains.LocationDomain; | ||||||
|  |  | ||||||
| namespace Domains.VisaApplicationDomain | namespace Domains.VisaApplicationDomain; | ||||||
| { |  | ||||||
| /// Model of visit request | /// Model of visit request | ||||||
| public class VisaApplication : IEntity | public class VisaApplication : IEntity | ||||||
| { | { | ||||||
| @@ -48,4 +48,3 @@ 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 | /// Category of visa | ||||||
| public enum VisaCategory | public enum VisaCategory | ||||||
| { | { | ||||||
|     Transit, |     Transit, | ||||||
|     ShortDated |     ShortDated | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -16,4 +16,3 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .HasMaxLength(10); |             .HasMaxLength(10); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -24,4 +24,3 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .HasMaxLength(30); |             .HasMaxLength(30); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -21,4 +21,3 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .HasMaxLength(50); |             .HasMaxLength(50); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -17,4 +17,3 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .HasMaxLength(200); |             .HasMaxLength(200); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -19,4 +19,3 @@ namespace Infrastructure.Database.Applicants.Configuration | |||||||
|             .HasMaxLength(20); |             .HasMaxLength(20); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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> | ||||||
| @@ -19,4 +19,3 @@ namespace Infrastructure.Database.Applicants.Repositories | |||||||
|             .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,8 +2,8 @@ | |||||||
| 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 | ||||||
| { | { | ||||||
| @@ -37,4 +37,3 @@ 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,8 +2,8 @@ | |||||||
| 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> | ||||||
| @@ -50,4 +50,3 @@ namespace Infrastructure.Database.Generic | |||||||
|         return reader.GetAll<T>(); |         return reader.GetAll<T>(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
| { |  | ||||||
| /// Reads from data storage | /// Reads from data storage | ||||||
| public interface IGenericReader | public interface IGenericReader | ||||||
| { | { | ||||||
| @@ -9,4 +9,3 @@ namespace Infrastructure.Database.Generic | |||||||
|     /// <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,7 +1,7 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
| { |  | ||||||
| /// <summary> | /// <summary> | ||||||
| /// Generic repository pattern | /// Generic repository pattern | ||||||
| /// </summary> | /// </summary> | ||||||
| @@ -34,4 +34,3 @@ namespace Infrastructure.Database.Generic | |||||||
|     /// Save changes in storage |     /// Save changes in storage | ||||||
|     Task SaveAsync(CancellationToken cancellationToken); |     Task SaveAsync(CancellationToken cancellationToken); | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| using Domains; | using Domains; | ||||||
|  |  | ||||||
| namespace Infrastructure.Database.Generic | namespace Infrastructure.Database.Generic; | ||||||
| { |  | ||||||
| /// Writes data to data storage | /// Writes data to data storage | ||||||
| /// <remarks><see cref="IUnitOfWork"/> should be used to save changes</remarks> | /// <remarks><see cref="IUnitOfWork"/> should be used to save changes</remarks> | ||||||
| public interface IGenericWriter | public interface IGenericWriter | ||||||
| @@ -22,4 +22,3 @@ namespace Infrastructure.Database.Generic | |||||||
|     /// <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,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -13,4 +13,3 @@ namespace Infrastructure.Database.Locations.Configuration | |||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -13,4 +13,3 @@ namespace Infrastructure.Database.Locations.Configuration | |||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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 | ||||||
| { | { | ||||||
| @@ -12,4 +12,3 @@ namespace Infrastructure.Database.Locations.Repositories.Cities | |||||||
|         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,8 +2,8 @@ | |||||||
| 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 | ||||||
| { | { | ||||||
| @@ -12,4 +12,3 @@ namespace Infrastructure.Database.Locations.Repositories.Countries | |||||||
|         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,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -13,4 +13,3 @@ namespace Infrastructure.Database.VisaApplications.Configuration | |||||||
|             .HasMaxLength(70); |             .HasMaxLength(70); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -13,4 +13,3 @@ namespace Infrastructure.Database.VisaApplications.Configuration | |||||||
|             .HasMaxLength(200); |             .HasMaxLength(200); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -13,4 +13,3 @@ namespace Infrastructure.Database.VisaApplications.Configuration | |||||||
|             .HasMaxLength(25); |             .HasMaxLength(25); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ | |||||||
| 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) | ||||||
| @@ -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,8 +2,8 @@ | |||||||
| 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 | ||||||
| { | { | ||||||
| @@ -15,4 +15,3 @@ namespace Infrastructure.Database.VisaApplications.Repositories | |||||||
|             .Include(a => a.PastVisits); |             .Include(a => a.PastVisits); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -8,8 +8,8 @@ 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 | /// Provides methods to add services to DI-container | ||||||
| public static class DependencyInjection | public static class DependencyInjection | ||||||
| { | { | ||||||
| @@ -32,4 +32,3 @@ namespace Infrastructure | |||||||
|         return services; |         return services; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| using System.Reflection; | using System.Reflection; | ||||||
| using Infrastructure; | using Infrastructure; | ||||||
|  |  | ||||||
| namespace SchengenVisaApi | namespace SchengenVisaApi; | ||||||
| { |  | ||||||
| /// Provides methods to add services to DI-container | /// Provides methods to add services to DI-container | ||||||
| public static class DependencyInjection | public static class DependencyInjection | ||||||
| { | { | ||||||
| @@ -28,4 +28,3 @@ namespace SchengenVisaApi | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| namespace SchengenVisaApi; | namespace SchengenVisaApi; | ||||||
|  |  | ||||||
| #pragma warning disable CS1591 | #pragma warning disable CS1591 | ||||||
| public class Program | public class Program | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| namespace SchengenVisaApi | namespace SchengenVisaApi; | ||||||
| { |  | ||||||
| /// Provides methods for configuring middleware | /// Provides methods for configuring middleware | ||||||
| public static class PipelineRequest | public static class PipelineRequest | ||||||
| { | { | ||||||
| @@ -16,4 +16,3 @@ | |||||||
|         return app; |         return app; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user