initial domain model
This commit is contained in:
commit
88b851b79a
9 changed files with 143 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
**/bin/
|
||||
**/obj/
|
||||
/packages/
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
.idea
|
27
Nyanbyte.PPCheck.sln
Normal file
27
Nyanbyte.PPCheck.sln
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C3B18ED6-C901-49BD-A417-B28A660CE50A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nyanbyte.PPCheck.Lib", "src\Nyanbyte.PPCheck.Lib\Nyanbyte.PPCheck.Lib.csproj", "{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{02AFAE01-FBD5-49EE-8D3F-329CDA5FEA79} = {C3B18ED6-C901-49BD-A417-B28A660CE50A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
5
README.md
Normal file
5
README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# PPCheck
|
||||
|
||||
Background checker integrated with the [National Sex Offenders Registry](https://rps.ms.gov.pl) :3 \
|
||||
This software performs a bulk check of employees, generating reports for any persons whose records might be within the registry. \
|
||||
Legal basis: [Dz. U. z 2023 r. poz. 1606](https://www.dziennikustaw.gov.pl/DU/rok/2023/pozycja/1606).
|
32
src/Nyanbyte.PPCheck.Lib/ApiClient.cs
Normal file
32
src/Nyanbyte.PPCheck.Lib/ApiClient.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
namespace Nyanbyte.PPCheck.Lib;
|
||||
|
||||
public class ApiClient : IDisposable
|
||||
{
|
||||
internal const string BaseAddr = "https://rps.ms.gov.pl/pl-PL/api/";
|
||||
|
||||
private readonly HttpClient _http;
|
||||
private readonly bool _isHttpExternal;
|
||||
|
||||
public ApiClient(HttpClient http)
|
||||
{
|
||||
_http = http;
|
||||
_isHttpExternal = true;
|
||||
}
|
||||
|
||||
public ApiClient()
|
||||
{
|
||||
_http = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(BaseAddr)
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
if (!_isHttpExternal)
|
||||
{
|
||||
_http.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
30
src/Nyanbyte.PPCheck.Lib/Models/OffenderInformation.cs
Normal file
30
src/Nyanbyte.PPCheck.Lib/Models/OffenderInformation.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Nyanbyte.PPCheck.Lib.Models;
|
||||
|
||||
public record OffenderInformation
|
||||
{
|
||||
public Guid PersonIdentityId { get; set; }
|
||||
public int AnnotationCount { get; set; }
|
||||
|
||||
[JsonPropertyName("persones")]
|
||||
public ICollection<OffenderPersona> Personas { get; set; } = new List<OffenderPersona>();
|
||||
}
|
||||
|
||||
public record OffenderPersona
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PersonIdentityId { get; set; }
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string? SecondName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string CityOfBirth { get; set; }
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
public string FamilyName { get; set; }
|
||||
public string? FathersName { get; set; }
|
||||
public string? MothersName { get; set; }
|
||||
public Sex Sex { get; set; }
|
||||
public string CountryOfBirth { get; set; }
|
||||
public string Nationalities { get; set; }
|
||||
public string DwellingPlace { get; set; }
|
||||
}
|
18
src/Nyanbyte.PPCheck.Lib/Models/Request.cs
Normal file
18
src/Nyanbyte.PPCheck.Lib/Models/Request.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Nyanbyte.PPCheck.Lib.Models;
|
||||
|
||||
public record SearchRequest
|
||||
{
|
||||
public bool Advanced { get; set; } = false;
|
||||
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? Nationality { get; set; }
|
||||
public string? CityOfBirth { get; set; }
|
||||
public string? CityOfResidence { get; set; }
|
||||
|
||||
public int Page { get; set; } = 0;
|
||||
public bool ShowYearCal => false;
|
||||
public string SortColumn => "LastName";
|
||||
public string SortOrder => "asc";
|
||||
public int Take => 5;
|
||||
}
|
9
src/Nyanbyte.PPCheck.Lib/Models/Response.cs
Normal file
9
src/Nyanbyte.PPCheck.Lib/Models/Response.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Nyanbyte.PPCheck.Lib.Models;
|
||||
|
||||
public record Response
|
||||
{
|
||||
public int Total { get; set; }
|
||||
public bool HasError { get; set; }
|
||||
|
||||
public ICollection<OffenderInformation> Data { get; set; } = new List<OffenderInformation>();
|
||||
}
|
7
src/Nyanbyte.PPCheck.Lib/Models/Sex.cs
Normal file
7
src/Nyanbyte.PPCheck.Lib/Models/Sex.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Nyanbyte.PPCheck.Lib.Models;
|
||||
|
||||
public enum Sex : byte
|
||||
{
|
||||
Male = (byte)'M',
|
||||
Female = (byte)'F'
|
||||
}
|
9
src/Nyanbyte.PPCheck.Lib/Nyanbyte.PPCheck.Lib.csproj
Normal file
9
src/Nyanbyte.PPCheck.Lib/Nyanbyte.PPCheck.Lib.csproj
Normal file
|
@ -0,0 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in a new issue