diff --git a/SchengenVisaApi/Domains/ApplicantDomain/Applicant.cs b/SchengenVisaApi/Domains/ApplicantDomain/Applicant.cs new file mode 100644 index 0000000..1710df4 --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/Applicant.cs @@ -0,0 +1,47 @@ +using Domains.Common; + +namespace Domains.ApplicantDomain +{ + /// Model of an applicant + public class Applicant : IEntity + { + /// Unique identifier of the + public Guid Id { get; set; } + + /// Full name of the + public Name Name { get; set; } = null!; + + /// Date of birth of the + public DateOnly BirthDate { get; set; } + + /// of birth of the + public Country CountryOfBirth { get; set; } = null!; + + /// of birth of the + public City CityOfBirth { get; set; } = null!; + + /// Citizenship of + public string Citizenship { get; set; } = null!; + + /// Citizenship by birth of + public string CitizenshipByBirth { get; set; } = null!; + + /// Gender of + public Gender Gender { get; set; } + + /// Marital status of + public MaritalStatus MaritalStatus { get; set; } + + /// Full name of the 's father + public Name FatherName { get; set; } = null!; + + /// Full name of the 's mother + public Name MotherName { get; set; } = null!; + + /// Place of 's work + public PlaceOfWork PlaceOfWork { get; set; } = null!; + + /// Is a non-resident + public bool IsNonResident { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/ApplicantDomain/Gender.cs b/SchengenVisaApi/Domains/ApplicantDomain/Gender.cs new file mode 100644 index 0000000..08588dc --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/Gender.cs @@ -0,0 +1,10 @@ +namespace Domains.ApplicantDomain +{ + public enum Gender + { + Unknown, + Male, + Female, + Turkish + } +} diff --git a/SchengenVisaApi/Domains/ApplicantDomain/MaritalStatus.cs b/SchengenVisaApi/Domains/ApplicantDomain/MaritalStatus.cs new file mode 100644 index 0000000..547edd6 --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/MaritalStatus.cs @@ -0,0 +1,11 @@ +namespace Domains.ApplicantDomain +{ + public enum MaritalStatus + { + Other, + Married, + Unmarried, + Separated, + WidowOrWidower + } +} diff --git a/SchengenVisaApi/Domains/ApplicantDomain/Name.cs b/SchengenVisaApi/Domains/ApplicantDomain/Name.cs new file mode 100644 index 0000000..2455318 --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/Name.cs @@ -0,0 +1,13 @@ +namespace Domains.ApplicantDomain +{ + /// Model of full name + /// Owned + public class Name + { + public string FirstName { get; set; } = null!; + + public string Surname { get; set; } = null!; + + public string? Patronymic { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/ApplicantDomain/Passport.cs b/SchengenVisaApi/Domains/ApplicantDomain/Passport.cs new file mode 100644 index 0000000..383b59f --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/Passport.cs @@ -0,0 +1,21 @@ +namespace Domains.ApplicantDomain +{ + /// Model of passport + public class Passport : IEntity + { + /// Unique identifier of + public Guid Id { get; set; } = Guid.NewGuid(); + + /// Number of + public string Number { get; set; } + + /// Issuing authority of + public string Issuer { get; set; } + + /// Date of issue + public DateOnly IssueDate { get; set; } + + /// Date when the expires + public DateOnly ExpirationDate { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/ApplicantDomain/PlaceOfWork.cs b/SchengenVisaApi/Domains/ApplicantDomain/PlaceOfWork.cs new file mode 100644 index 0000000..bb1521c --- /dev/null +++ b/SchengenVisaApi/Domains/ApplicantDomain/PlaceOfWork.cs @@ -0,0 +1,19 @@ +using Domains.Common; + +namespace Domains.ApplicantDomain +{ + public class PlaceOfWork : IEntity + { + /// Unique identifier of + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// Name of hirer + public string Name { get; set; } = null!; + + /// of hirer + public Address Address { get; set; } = null!; + + /// Phone number of hirer + public string PhoneNum { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/Domains/Common/Address.cs b/SchengenVisaApi/Domains/Common/Address.cs new file mode 100644 index 0000000..1e6bca5 --- /dev/null +++ b/SchengenVisaApi/Domains/Common/Address.cs @@ -0,0 +1,19 @@ +namespace Domains.Common +{ + /// Model of address + /// Owned + public class Address + { + /// Country part of address + public Country Country { get; set; } = null!; + + /// City part of address + public City City { get; set; } = null!; + + /// Street part of address + public string Street { get; set; } = null!; + + /// Building part of address + public string Building { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/Domains/Common/City.cs b/SchengenVisaApi/Domains/Common/City.cs new file mode 100644 index 0000000..36ac76d --- /dev/null +++ b/SchengenVisaApi/Domains/Common/City.cs @@ -0,0 +1,15 @@ +namespace Domains.Common +{ + /// Model of a city + public class City : IEntity + { + /// Unique identifier of the city + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// Name of the city + public string Name { get; set; } = null!; + + /// in which the city is located + public Country Country { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/Domains/Common/Country.cs b/SchengenVisaApi/Domains/Common/Country.cs new file mode 100644 index 0000000..ed9b928 --- /dev/null +++ b/SchengenVisaApi/Domains/Common/Country.cs @@ -0,0 +1,15 @@ +namespace Domains.Common +{ + /// Model of a country + public class Country : IEntity + { + /// Name of the country + public string Name { get; set; } = null!; + + /// Located in Schengen area + public bool IsSchengen { get; set; } + + /// List of that country have + public List Cities { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/Domains/Domains.csproj b/SchengenVisaApi/Domains/Domains.csproj new file mode 100644 index 0000000..3a63532 --- /dev/null +++ b/SchengenVisaApi/Domains/Domains.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/SchengenVisaApi/Domains/IEntity.cs b/SchengenVisaApi/Domains/IEntity.cs new file mode 100644 index 0000000..bc6d213 --- /dev/null +++ b/SchengenVisaApi/Domains/IEntity.cs @@ -0,0 +1,5 @@ +namespace Domains +{ + /// Interface that every entity should inherit from + public interface IEntity { } +} diff --git a/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisa.cs b/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisa.cs new file mode 100644 index 0000000..077557d --- /dev/null +++ b/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisa.cs @@ -0,0 +1,20 @@ +using Domains.ApplicantDomain; + +namespace Domains.VisaApplicationDomain +{ + /// Visa that already had + public class PastVisa : IEntity + { + /// Unique identifier of + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// Date of issue + public DateOnly IssueDate { get; set; } + + /// Name of visa + public string Name { get; set; } = null!; + + /// Date when visa expires + public DateOnly ExpirationDate { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisit.cs b/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisit.cs new file mode 100644 index 0000000..b6b2407 --- /dev/null +++ b/SchengenVisaApi/Domains/VisaApplicationDomain/PastVisit.cs @@ -0,0 +1,17 @@ +using Domains.ApplicantDomain; + +namespace Domains.VisaApplicationDomain +{ + /// Visit in a Schengen country that already had + public class PastVisit : IEntity + { + /// Unique identifier of + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// First day of + public DateOnly StartDate { get; set; } + + /// Last day of + public DateOnly EndDate { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/VisaApplicationDomain/PermissionToDestCountry.cs b/SchengenVisaApi/Domains/VisaApplicationDomain/PermissionToDestCountry.cs new file mode 100644 index 0000000..93160cc --- /dev/null +++ b/SchengenVisaApi/Domains/VisaApplicationDomain/PermissionToDestCountry.cs @@ -0,0 +1,13 @@ +namespace Domains.VisaApplicationDomain +{ + /// Permission to enter the destination country + /// Owned + public class PermissionToDestCountry + { + /// Date when expires + public DateOnly ExpirationDate { get; set; } + + /// Issuing authority + public string Issuer { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/Domains/VisaApplicationDomain/ReentryPermit.cs b/SchengenVisaApi/Domains/VisaApplicationDomain/ReentryPermit.cs new file mode 100644 index 0000000..d01d4b0 --- /dev/null +++ b/SchengenVisaApi/Domains/VisaApplicationDomain/ReentryPermit.cs @@ -0,0 +1,12 @@ +namespace Domains.VisaApplicationDomain +{ + /// Permission to enter a country the issuer wants to come from + public class ReentryPermit : IEntity + { + /// Unique identifier of + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// Date when expires + public DateOnly ExpirationDate { get; set; } + } +} diff --git a/SchengenVisaApi/Domains/VisaApplicationDomain/VisaApplication.cs b/SchengenVisaApi/Domains/VisaApplicationDomain/VisaApplication.cs new file mode 100644 index 0000000..34a9bdf --- /dev/null +++ b/SchengenVisaApi/Domains/VisaApplicationDomain/VisaApplication.cs @@ -0,0 +1,33 @@ +using Domains.ApplicantDomain; +using Domains.Common; + +namespace Domains.VisaApplicationDomain +{ + /// Model of visit request + public class VisaApplication : IEntity + { + /// Unique identifier of + public Guid Id { get; private set; } = Guid.NewGuid(); + + /// Applicant of + public Applicant Applicant { get; set; } = null!; + + /// + /// always null if is not a non-resident + public ReentryPermit? ReentryPermit { get; set; } + + /// that wants to visit + public Country DestinationCountry { get; set; } = null!; + + /// + /// List of that applicant had before + /// + public List PastVisas { get; set; } = null!; + + /// Permission to enter the destination country of + /// always null if is Schengen + public PermissionToDestCountry? PermissionToDestCountry { get; set; } + + public List PastVisits { get; set; } = null!; + } +} diff --git a/SchengenVisaApi/SchengenVisaApi.sln b/SchengenVisaApi/SchengenVisaApi.sln index 93fb9d0..c282fa7 100644 --- a/SchengenVisaApi/SchengenVisaApi.sln +++ b/SchengenVisaApi/SchengenVisaApi.sln @@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchengenVisaApi", "SchengenVisaApi\SchengenVisaApi.csproj", "{BA957CD4-48D1-4B24-A0E0-BA57B84B1DC3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Domains", "Domains\Domains.csproj", "{5DC8BC74-5A1F-48E3-9EB8-6C50CD3D7778}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +14,9 @@ Global {BA957CD4-48D1-4B24-A0E0-BA57B84B1DC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {BA957CD4-48D1-4B24-A0E0-BA57B84B1DC3}.Release|Any CPU.ActiveCfg = Release|Any CPU {BA957CD4-48D1-4B24-A0E0-BA57B84B1DC3}.Release|Any CPU.Build.0 = Release|Any CPU + {5DC8BC74-5A1F-48E3-9EB8-6C50CD3D7778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DC8BC74-5A1F-48E3-9EB8-6C50CD3D7778}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DC8BC74-5A1F-48E3-9EB8-6C50CD3D7778}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DC8BC74-5A1F-48E3-9EB8-6C50CD3D7778}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/SchengenVisaApi/SchengenVisaApi/Controllers/VisaApplicationController.cs b/SchengenVisaApi/SchengenVisaApi/Controllers/VisaApplicationController.cs new file mode 100644 index 0000000..0dead79 --- /dev/null +++ b/SchengenVisaApi/SchengenVisaApi/Controllers/VisaApplicationController.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Mvc; + +namespace SchengenVisaApi.Controllers; + +[ApiController] +[Route("[controller]")] +public class VisaApplicationController : ControllerBase +{ + + public VisaApplicationController() + { + + } + + [HttpGet] + public void Create() + { + throw new NotImplementedException(); + } +} diff --git a/SchengenVisaApi/SchengenVisaApi/Controllers/WeatherForecastController.cs b/SchengenVisaApi/SchengenVisaApi/Controllers/WeatherForecastController.cs deleted file mode 100644 index fd59a14..0000000 --- a/SchengenVisaApi/SchengenVisaApi/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace SchengenVisaApi.Controllers; - -[ApiController] -[Route("[controller]")] -public class WeatherForecastController : ControllerBase -{ - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } -} \ No newline at end of file diff --git a/SchengenVisaApi/SchengenVisaApi/Program.cs b/SchengenVisaApi/SchengenVisaApi/Program.cs index 58c77b1..b7a5af3 100644 --- a/SchengenVisaApi/SchengenVisaApi/Program.cs +++ b/SchengenVisaApi/SchengenVisaApi/Program.cs @@ -1,26 +1,24 @@ +using System.Reflection; + namespace SchengenVisaApi; +#pragma warning disable CS1591 public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); - - // Add services to the container. - builder.Services.AddControllers(); - // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(); + builder.Services.AddSwaggerGen(options => + { + var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename)); + }); var app = builder.Build(); - - // Configure the HTTP request pipeline. - if (app.Environment.IsDevelopment()) - { app.UseSwagger(); app.UseSwaggerUI(); - } app.UseHttpsRedirection(); @@ -31,4 +29,5 @@ public class Program app.Run(); } -} \ No newline at end of file +} +#pragma warning restore CS1591 diff --git a/SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj b/SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj index d997d54..f0e6a54 100644 --- a/SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj +++ b/SchengenVisaApi/SchengenVisaApi/SchengenVisaApi.csproj @@ -5,6 +5,7 @@ enable enable true + true diff --git a/SchengenVisaApi/SchengenVisaApi/WeatherForecast.cs b/SchengenVisaApi/SchengenVisaApi/WeatherForecast.cs deleted file mode 100644 index b073497..0000000 --- a/SchengenVisaApi/SchengenVisaApi/WeatherForecast.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace SchengenVisaApi; - -public class WeatherForecast -{ - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } -} \ No newline at end of file