Skip to content

Commit

Permalink
Merge branch 'master' into lab-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedegeofroy authored Mar 15, 2024
2 parents 8cb95e1 + b29dda2 commit 5e49c44
Show file tree
Hide file tree
Showing 62 changed files with 1,585 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,9 @@ csharp_style_namespace_declarations = file_scoped:warning
dotnet_diagnostic.CS1591.severity = none

dotnet_diagnostic.CA1062.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1034.severity = none
dotnet_diagnostic.CA2012.severity = none

[/src/Lab5/ATM.Infrastructure.DataAccess/Migrations/*.cs]
dotnet_diagnostic.SA1649.severity = none
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Itmo.Dev.Platform.Postgres" Version="1.1.75" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="SourceKit.Analyzers.Collections" Version="1.0.4" />
<PackageVersion Include="SourceKit.Analyzers.Enumerable" Version="1.0.4" />
<PackageVersion Include="SourceKit.Analyzers.MemberAccessibility" Version="1.0.4" />
<PackageVersion Include="SourceKit.Analyzers.Nullable" Version="1.0.4" />
<PackageVersion Include="SourceKit.Analyzers.Properties" Version="1.0.4" />
<PackageVersion Include="Spectre.Console" Version="0.48.1-preview.0.5" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
Expand Down
71 changes: 68 additions & 3 deletions Itmo.ObjectOrientedProgramming.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3", "src\Lab3\Lab3.cspro
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab4", "src\Lab4\Lab4.csproj", "{A53D3DBD-FA2D-47B4-90A9-B44AF07ADE71}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lab5", "Lab5", "{55C309C9-B7DE-4F64-AFDE-A33F9C2AB2D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab2.Tests", "tests\Lab2.Tests\Lab2.Tests.csproj", "{25D0E1F0-760B-4E76-B0D9-3EF274B35AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3.Tests", "tests\Lab3.Tests\Lab3.Tests.csproj", "{7E5E46DB-EF55-47E6-822A-6AE20BF2FCD9}"
Expand All @@ -31,6 +29,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab4.Tests", "tests\Lab4.Te
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab5.Tests", "tests\Lab5.Tests\Lab5.Tests.csproj", "{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lab5", "Lab5", "{99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{D6F0AF28-4B74-4CEF-BAE0-631C60979762}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{A882AA78-975B-4BF0-9193-5A0C5365974C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedTellerMachine", "src\Lab5\AutomatedTellerMachine\AutomatedTellerMachine.csproj", "{9BAA271C-E0CC-42C8-83E7-FC398D53874F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application", "src\Lab5\ATM.Application\ATM.Application.csproj", "{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Models", "src\Lab5\ATM.Application.Models\ATM.Application.Models.csproj", "{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Abstractions", "src\Lab5\ATM.Application.Abstractions\ATM.Application.Abstractions.csproj", "{249A7B78-E81D-4127-901F-207159D59BCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Contracts", "src\Lab5\ATM.Application.Contracts\ATM.Application.Contracts.csproj", "{D1EA8947-0596-48FF-A5AF-B6B51C63A484}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Infrastructure.DataAccess", "src\Lab5\ATM.Infrastructure.DataAccess\ATM.Infrastructure.DataAccess.csproj", "{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{E078567B-7E99-44F0-BE59-861B99056106}"
ProjectSection(SolutionItems) = preProject
src\Lab5\.env = src\Lab5\.env
src\Lab5\docker-compose.yaml = src\Lab5\docker-compose.yaml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Presentation.Console", "src\Lab5\ATM.Presentation.Console\ATM.Presentation.Console.csproj", "{581A4324-47EC-4DF7-9839-F58450EA54F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -42,11 +68,22 @@ Global
{433B9342-A6BF-4194-8F08-727AADAE7504} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
{43B4CD48-18D5-4EDE-80CB-86460F4C64CB} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
{A53D3DBD-FA2D-47B4-90A9-B44AF07ADE71} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
{55C309C9-B7DE-4F64-AFDE-A33F9C2AB2D4} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
{25D0E1F0-760B-4E76-B0D9-3EF274B35AF6} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
{7E5E46DB-EF55-47E6-822A-6AE20BF2FCD9} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
{17689E4A-FE4F-4893-8E28-3BA911DEC8D8} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
{99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
{08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
{D6F0AF28-4B74-4CEF-BAE0-631C60979762} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
{A882AA78-975B-4BF0-9193-5A0C5365974C} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
{9BAA271C-E0CC-42C8-83E7-FC398D53874F} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
{249A7B78-E81D-4127-901F-207159D59BCB} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
{D1EA8947-0596-48FF-A5AF-B6B51C63A484} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82} = {A882AA78-975B-4BF0-9193-5A0C5365974C}
{E078567B-7E99-44F0-BE59-861B99056106} = {21E20419-0C74-46BC-9D7D-A24CEEC29ACC}
{581A4324-47EC-4DF7-9839-F58450EA54F0} = {08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EABA4888-E6C1-4ACC-856E-FBD34CEA3EDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -85,5 +122,33 @@ Global
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Release|Any CPU.Build.0 = Release|Any CPU
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Release|Any CPU.Build.0 = Release|Any CPU
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Release|Any CPU.Build.0 = Release|Any CPU
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Release|Any CPU.Build.0 = Release|Any CPU
{249A7B78-E81D-4127-901F-207159D59BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{249A7B78-E81D-4127-901F-207159D59BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{249A7B78-E81D-4127-901F-207159D59BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{249A7B78-E81D-4127-901F-207159D59BCB}.Release|Any CPU.Build.0 = Release|Any CPU
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Release|Any CPU.Build.0 = Release|Any CPU
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Release|Any CPU.Build.0 = Release|Any CPU
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions src/Lab5/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=atm_labwork
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>AutomatedTellerMachine.Abstractions</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ATM.Application.Models\ATM.Application.Models.csproj" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions src/Lab5/ATM.Application.Abstractions/Auth/GenerateResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AutomatedTellerMachine.Abstractions.Auth;

public abstract record GenerateResult
{
private GenerateResult() { }

public sealed record Success(string Token) : GenerateResult;

public sealed record NotFound : GenerateResult;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace AutomatedTellerMachine.Abstractions.Auth;

public interface IAuthenticationService
{
GenerateResult Generate(long id, string hashedPin);
ValidationResult Validate(long id, string token);
}
12 changes: 12 additions & 0 deletions src/Lab5/ATM.Application.Abstractions/Auth/ValidationResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace AutomatedTellerMachine.Abstractions.Auth;

public abstract record ValidationResult
{
private ValidationResult() { }

public sealed record Success : ValidationResult;

public sealed record TimedOut : ValidationResult;

public sealed record NotFound : ValidationResult;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using AutomatedTellerMachine.Models;

namespace AutomatedTellerMachine.Abstractions.Repositories;

public interface IAccountRepository
{
Account CreateAccount(string hashedPin);
double GetBalanceByAccountId(long id);

void Debit(long id, double amount);
void Credit(long id, double amount);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using AutomatedTellerMachine.Models;

namespace AutomatedTellerMachine.Abstractions.Repositories;

public interface IOperationsRepository
{
IEnumerable<Operation> GetOperationsByAccount(long id);
void AddOperation(long id, double amount);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace AutomatedTellerMachine.Abstractions.Repositories;

public interface IPinRepository
{
string GetPinHashByAccountId(long id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>AutomatedTellerMachine.Contracts</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ATM.Application.Models\ATM.Application.Models.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/Lab5/ATM.Application.Contracts/Accounts/IAccountService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using AutomatedTellerMachine.Models;

namespace AutomatedTellerMachine.Contracts.Accounts;

public interface IAccountService
{
LoginResult Login(long id, string hashedPin);

double GetBalance(long id, string token);

OperationResult Credit(double amount, long id, string token);
OperationResult Debit(double amount, long id, string token);

IEnumerable<Operation> GetOperations(long id, string token);
long Create(string hashedPin);
}
10 changes: 10 additions & 0 deletions src/Lab5/ATM.Application.Contracts/Accounts/LoginResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AutomatedTellerMachine.Contracts.Accounts;

public abstract record LoginResult
{
private LoginResult() { }

public sealed record Success(string Token) : LoginResult;

public sealed record NotFound : LoginResult;
}
10 changes: 10 additions & 0 deletions src/Lab5/ATM.Application.Contracts/Accounts/OperationResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AutomatedTellerMachine.Contracts.Accounts;

public abstract record OperationResult
{
private OperationResult() { }

public sealed record Success : OperationResult;

public sealed record Failure : OperationResult;
}
8 changes: 8 additions & 0 deletions src/Lab5/ATM.Application.Contracts/Admin/IAdminService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using AutomatedTellerMachine.Contracts.Accounts;

namespace AutomatedTellerMachine.Contracts.Admin;

public interface IAdminService
{
LoginResult AdminLogin(string hashPass);
}
10 changes: 10 additions & 0 deletions src/Lab5/ATM.Application.Models/ATM.Application.Models.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>AutomatedTellerMachine.Models</RootNamespace>
</PropertyGroup>

</Project>
3 changes: 3 additions & 0 deletions src/Lab5/ATM.Application.Models/Account.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace AutomatedTellerMachine.Models;

public record Account(long Id);
3 changes: 3 additions & 0 deletions src/Lab5/ATM.Application.Models/Operation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace AutomatedTellerMachine.Models;

public record Operation(long Id, double Amount);
19 changes: 19 additions & 0 deletions src/Lab5/ATM.Application/ATM.Application.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>AutomatedTellerMachine.Application</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ATM.Application.Abstractions\ATM.Application.Abstractions.csproj" />
<ProjectReference Include="..\ATM.Application.Contracts\ATM.Application.Contracts.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>

</Project>
Loading

0 comments on commit 5e49c44

Please sign in to comment.