Skip to content

Commit 5e49c44

Browse files
Merge branch 'master' into lab-1
2 parents 8cb95e1 + b29dda2 commit 5e49c44

File tree

62 files changed

+1585
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1585
-4
lines changed

.editorconfig

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,9 @@ csharp_style_namespace_declarations = file_scoped:warning
9494
dotnet_diagnostic.CS1591.severity = none
9595

9696
dotnet_diagnostic.CA1062.severity = none
97-
dotnet_diagnostic.CA1707.severity = none
97+
dotnet_diagnostic.CA1707.severity = none
98+
dotnet_diagnostic.CA1034.severity = none
99+
dotnet_diagnostic.CA2012.severity = none
100+
101+
[/src/Lab5/ATM.Infrastructure.DataAccess/Migrations/*.cs]
102+
dotnet_diagnostic.SA1649.severity = none

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<TargetFramework>net7.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>enable</Nullable>
6+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
67
</PropertyGroup>
78

89
<PropertyGroup>

Directory.Packages.props

+4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
8+
<PackageVersion Include="Itmo.Dev.Platform.Postgres" Version="1.1.75" />
9+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
10+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
811
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
912
<PackageVersion Include="NSubstitute" Version="5.1.0" />
1013
<PackageVersion Include="SourceKit.Analyzers.Collections" Version="1.0.4" />
1114
<PackageVersion Include="SourceKit.Analyzers.Enumerable" Version="1.0.4" />
1215
<PackageVersion Include="SourceKit.Analyzers.MemberAccessibility" Version="1.0.4" />
1316
<PackageVersion Include="SourceKit.Analyzers.Nullable" Version="1.0.4" />
1417
<PackageVersion Include="SourceKit.Analyzers.Properties" Version="1.0.4" />
18+
<PackageVersion Include="Spectre.Console" Version="0.48.1-preview.0.5" />
1519
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
1620
<PackageVersion Include="xunit" Version="2.5.0" />
1721
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />

Itmo.ObjectOrientedProgramming.sln

+68-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3", "src\Lab3\Lab3.cspro
2121
EndProject
2222
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab4", "src\Lab4\Lab4.csproj", "{A53D3DBD-FA2D-47B4-90A9-B44AF07ADE71}"
2323
EndProject
24-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lab5", "Lab5", "{55C309C9-B7DE-4F64-AFDE-A33F9C2AB2D4}"
25-
EndProject
2624
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab2.Tests", "tests\Lab2.Tests\Lab2.Tests.csproj", "{25D0E1F0-760B-4E76-B0D9-3EF274B35AF6}"
2725
EndProject
2826
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3.Tests", "tests\Lab3.Tests\Lab3.Tests.csproj", "{7E5E46DB-EF55-47E6-822A-6AE20BF2FCD9}"
@@ -31,6 +29,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab4.Tests", "tests\Lab4.Te
3129
EndProject
3230
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab5.Tests", "tests\Lab5.Tests\Lab5.Tests.csproj", "{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}"
3331
EndProject
32+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lab5", "Lab5", "{99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}"
33+
EndProject
34+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presentation", "Presentation", "{08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E}"
35+
EndProject
36+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{D6F0AF28-4B74-4CEF-BAE0-631C60979762}"
37+
EndProject
38+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{A882AA78-975B-4BF0-9193-5A0C5365974C}"
39+
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutomatedTellerMachine", "src\Lab5\AutomatedTellerMachine\AutomatedTellerMachine.csproj", "{9BAA271C-E0CC-42C8-83E7-FC398D53874F}"
41+
EndProject
42+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application", "src\Lab5\ATM.Application\ATM.Application.csproj", "{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}"
43+
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Models", "src\Lab5\ATM.Application.Models\ATM.Application.Models.csproj", "{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}"
45+
EndProject
46+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Abstractions", "src\Lab5\ATM.Application.Abstractions\ATM.Application.Abstractions.csproj", "{249A7B78-E81D-4127-901F-207159D59BCB}"
47+
EndProject
48+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Application.Contracts", "src\Lab5\ATM.Application.Contracts\ATM.Application.Contracts.csproj", "{D1EA8947-0596-48FF-A5AF-B6B51C63A484}"
49+
EndProject
50+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Infrastructure.DataAccess", "src\Lab5\ATM.Infrastructure.DataAccess\ATM.Infrastructure.DataAccess.csproj", "{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}"
51+
EndProject
52+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{E078567B-7E99-44F0-BE59-861B99056106}"
53+
ProjectSection(SolutionItems) = preProject
54+
src\Lab5\.env = src\Lab5\.env
55+
src\Lab5\docker-compose.yaml = src\Lab5\docker-compose.yaml
56+
EndProjectSection
57+
EndProject
58+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ATM.Presentation.Console", "src\Lab5\ATM.Presentation.Console\ATM.Presentation.Console.csproj", "{581A4324-47EC-4DF7-9839-F58450EA54F0}"
59+
EndProject
3460
Global
3561
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3662
Debug|Any CPU = Debug|Any CPU
@@ -42,11 +68,22 @@ Global
4268
{433B9342-A6BF-4194-8F08-727AADAE7504} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
4369
{43B4CD48-18D5-4EDE-80CB-86460F4C64CB} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
4470
{A53D3DBD-FA2D-47B4-90A9-B44AF07ADE71} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
45-
{55C309C9-B7DE-4F64-AFDE-A33F9C2AB2D4} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
4671
{25D0E1F0-760B-4E76-B0D9-3EF274B35AF6} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
4772
{7E5E46DB-EF55-47E6-822A-6AE20BF2FCD9} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
4873
{17689E4A-FE4F-4893-8E28-3BA911DEC8D8} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
4974
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB} = {792FFE57-F1A0-47A4-9E2A-80F75FF2F8DB}
75+
{99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809} = {8ED774F4-D429-4B82-B768-50DCA8EFF609}
76+
{08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
77+
{D6F0AF28-4B74-4CEF-BAE0-631C60979762} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
78+
{A882AA78-975B-4BF0-9193-5A0C5365974C} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
79+
{9BAA271C-E0CC-42C8-83E7-FC398D53874F} = {99CB5FCA-AC39-4AD0-B4FF-A8C051CC2809}
80+
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
81+
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
82+
{249A7B78-E81D-4127-901F-207159D59BCB} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
83+
{D1EA8947-0596-48FF-A5AF-B6B51C63A484} = {D6F0AF28-4B74-4CEF-BAE0-631C60979762}
84+
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82} = {A882AA78-975B-4BF0-9193-5A0C5365974C}
85+
{E078567B-7E99-44F0-BE59-861B99056106} = {21E20419-0C74-46BC-9D7D-A24CEEC29ACC}
86+
{581A4324-47EC-4DF7-9839-F58450EA54F0} = {08E62A91-F7B4-4FE8-A1F8-BFD64F7E3A9E}
5087
EndGlobalSection
5188
GlobalSection(ProjectConfigurationPlatforms) = postSolution
5289
{EABA4888-E6C1-4ACC-856E-FBD34CEA3EDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -85,5 +122,33 @@ Global
85122
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
86123
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
87124
{FA627A62-AD7A-4A72-B15C-EC8AEFD206DB}.Release|Any CPU.Build.0 = Release|Any CPU
125+
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126+
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Debug|Any CPU.Build.0 = Debug|Any CPU
127+
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Release|Any CPU.ActiveCfg = Release|Any CPU
128+
{9BAA271C-E0CC-42C8-83E7-FC398D53874F}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130+
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
131+
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{6A71BA8C-6A36-4B80-9E97-4F99C8BFF1E9}.Release|Any CPU.Build.0 = Release|Any CPU
133+
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
134+
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
135+
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
136+
{8469CC97-19D1-4ABA-9213-99F03DA8BBF2}.Release|Any CPU.Build.0 = Release|Any CPU
137+
{249A7B78-E81D-4127-901F-207159D59BCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
138+
{249A7B78-E81D-4127-901F-207159D59BCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
139+
{249A7B78-E81D-4127-901F-207159D59BCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
140+
{249A7B78-E81D-4127-901F-207159D59BCB}.Release|Any CPU.Build.0 = Release|Any CPU
141+
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
142+
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Debug|Any CPU.Build.0 = Debug|Any CPU
143+
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Release|Any CPU.ActiveCfg = Release|Any CPU
144+
{D1EA8947-0596-48FF-A5AF-B6B51C63A484}.Release|Any CPU.Build.0 = Release|Any CPU
145+
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
146+
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Debug|Any CPU.Build.0 = Debug|Any CPU
147+
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Release|Any CPU.ActiveCfg = Release|Any CPU
148+
{9B57FEE1-2A6D-49D8-8C48-AA3993BD1F82}.Release|Any CPU.Build.0 = Release|Any CPU
149+
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
150+
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
151+
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
152+
{581A4324-47EC-4DF7-9839-F58450EA54F0}.Release|Any CPU.Build.0 = Release|Any CPU
88153
EndGlobalSection
89154
EndGlobal

src/Lab5/.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMPOSE_PROJECT_NAME=atm_labwork
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<RootNamespace>AutomatedTellerMachine.Abstractions</RootNamespace>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\ATM.Application.Models\ATM.Application.Models.csproj" />
12+
</ItemGroup>
13+
14+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace AutomatedTellerMachine.Abstractions.Auth;
2+
3+
public abstract record GenerateResult
4+
{
5+
private GenerateResult() { }
6+
7+
public sealed record Success(string Token) : GenerateResult;
8+
9+
public sealed record NotFound : GenerateResult;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace AutomatedTellerMachine.Abstractions.Auth;
2+
3+
public interface IAuthenticationService
4+
{
5+
GenerateResult Generate(long id, string hashedPin);
6+
ValidationResult Validate(long id, string token);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace AutomatedTellerMachine.Abstractions.Auth;
2+
3+
public abstract record ValidationResult
4+
{
5+
private ValidationResult() { }
6+
7+
public sealed record Success : ValidationResult;
8+
9+
public sealed record TimedOut : ValidationResult;
10+
11+
public sealed record NotFound : ValidationResult;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using AutomatedTellerMachine.Models;
2+
3+
namespace AutomatedTellerMachine.Abstractions.Repositories;
4+
5+
public interface IAccountRepository
6+
{
7+
Account CreateAccount(string hashedPin);
8+
double GetBalanceByAccountId(long id);
9+
10+
void Debit(long id, double amount);
11+
void Credit(long id, double amount);
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using AutomatedTellerMachine.Models;
2+
3+
namespace AutomatedTellerMachine.Abstractions.Repositories;
4+
5+
public interface IOperationsRepository
6+
{
7+
IEnumerable<Operation> GetOperationsByAccount(long id);
8+
void AddOperation(long id, double amount);
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace AutomatedTellerMachine.Abstractions.Repositories;
2+
3+
public interface IPinRepository
4+
{
5+
string GetPinHashByAccountId(long id);
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<RootNamespace>AutomatedTellerMachine.Contracts</RootNamespace>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\ATM.Application.Models\ATM.Application.Models.csproj" />
12+
</ItemGroup>
13+
14+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using AutomatedTellerMachine.Models;
2+
3+
namespace AutomatedTellerMachine.Contracts.Accounts;
4+
5+
public interface IAccountService
6+
{
7+
LoginResult Login(long id, string hashedPin);
8+
9+
double GetBalance(long id, string token);
10+
11+
OperationResult Credit(double amount, long id, string token);
12+
OperationResult Debit(double amount, long id, string token);
13+
14+
IEnumerable<Operation> GetOperations(long id, string token);
15+
long Create(string hashedPin);
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace AutomatedTellerMachine.Contracts.Accounts;
2+
3+
public abstract record LoginResult
4+
{
5+
private LoginResult() { }
6+
7+
public sealed record Success(string Token) : LoginResult;
8+
9+
public sealed record NotFound : LoginResult;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace AutomatedTellerMachine.Contracts.Accounts;
2+
3+
public abstract record OperationResult
4+
{
5+
private OperationResult() { }
6+
7+
public sealed record Success : OperationResult;
8+
9+
public sealed record Failure : OperationResult;
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using AutomatedTellerMachine.Contracts.Accounts;
2+
3+
namespace AutomatedTellerMachine.Contracts.Admin;
4+
5+
public interface IAdminService
6+
{
7+
LoginResult AdminLogin(string hashPass);
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<RootNamespace>AutomatedTellerMachine.Models</RootNamespace>
8+
</PropertyGroup>
9+
10+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace AutomatedTellerMachine.Models;
2+
3+
public record Account(long Id);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace AutomatedTellerMachine.Models;
2+
3+
public record Operation(long Id, double Amount);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<RootNamespace>AutomatedTellerMachine.Application</RootNamespace>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\ATM.Application.Abstractions\ATM.Application.Abstractions.csproj" />
12+
<ProjectReference Include="..\ATM.Application.Contracts\ATM.Application.Contracts.csproj" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
17+
</ItemGroup>
18+
19+
</Project>

0 commit comments

Comments
 (0)