From 2411841bdc0f240f94c5abdf42bb02ab575dd6dd Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Thu, 12 Feb 2026 00:56:52 -0500 Subject: [PATCH] create Infrastructure directory --- docker-compose.test.yaml | 2 +- src/Core/API/API.Core/API.Core.csproj | 4 +++- src/Core/API/API.Core/Dockerfile | 5 ++++- src/Core/API/API.Specs/Dockerfile | 5 ++++- src/Core/Core.slnx | 10 +++++++--- .../Database/Database.Seed/Database.Seed.csproj | 3 ++- .../Infrastructure.Jwt}/IJwtService.cs | 0 .../Infrastructure.Jwt/Infrastructure.Jwt.csproj | 13 +++++++++++++ .../Infrastructure.Jwt}/JwtService.cs | 0 .../IPasswordService.cs | 0 .../Infrastructure.PasswordHashing.csproj | 12 ++++++++++++ .../PasswordService.cs | 0 .../Repositories/Auth/AuthRepository.cs | 0 .../Repositories/Auth/IAuthRepository.cs | 0 .../Repository.Core/Repositories/Repository.cs | 0 .../UserAccount/IUserAccountRepository.cs | 0 .../UserAccount/UserAccountRepository.cs | 0 .../Repository.Core/Repository.Core.csproj | 2 +- .../Sql/DefaultSqlConnectionFactory.cs | 0 .../Repository.Core/Sql/ISqlConnectionFactory.cs | 0 .../Sql/SqlConnectionStringHelper.cs | 0 .../Repository.Tests/Auth/AuthRepository.test.cs | 0 .../Repository.Tests/Dockerfile | 15 +++++++++++++++ .../Repository.Tests/Repository.Tests.csproj | 0 .../UserAccount/UserAccountRepository.test.cs | 0 .../Database/TestConnectionFactory.cs | 10 ---------- src/Core/Repository/Repository.Tests/Dockerfile | 14 -------------- src/Core/Service/Service.Core/Service.Core.csproj | 5 ++++- 28 files changed, 66 insertions(+), 34 deletions(-) rename src/Core/{Service/Service.Core/Jwt => Infrastructure/Infrastructure.Jwt}/IJwtService.cs (100%) create mode 100644 src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj rename src/Core/{Service/Service.Core/Jwt => Infrastructure/Infrastructure.Jwt}/JwtService.cs (100%) rename src/Core/{Service/Service.Core/Password => Infrastructure/Infrastructure.PasswordHashing}/IPasswordService.cs (100%) create mode 100644 src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj rename src/Core/{Service/Service.Core/Password => Infrastructure/Infrastructure.PasswordHashing}/PasswordService.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repositories/Auth/AuthRepository.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repositories/Auth/IAuthRepository.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repositories/Repository.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Repository.Core.csproj (91%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Sql/DefaultSqlConnectionFactory.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Sql/ISqlConnectionFactory.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Core/Sql/SqlConnectionStringHelper.cs (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Tests/Auth/AuthRepository.test.cs (100%) create mode 100644 src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Dockerfile rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Tests/Repository.Tests.csproj (100%) rename src/Core/{Repository => Infrastructure/Infrastructure.Repository}/Repository.Tests/UserAccount/UserAccountRepository.test.cs (100%) delete mode 100644 src/Core/Repository/Repository.Tests/Database/TestConnectionFactory.cs delete mode 100644 src/Core/Repository/Repository.Tests/Dockerfile diff --git a/docker-compose.test.yaml b/docker-compose.test.yaml index 17b2cf2..4da36ef 100644 --- a/docker-compose.test.yaml +++ b/docker-compose.test.yaml @@ -101,7 +101,7 @@ services: condition: service_completed_successfully build: context: ./src/Core - dockerfile: Repository/Repository.Tests/Dockerfile + dockerfile: Infrastructure/Infrastructure.Repository/Repository.Tests/Dockerfile args: BUILD_CONFIGURATION: Release environment: diff --git a/src/Core/API/API.Core/API.Core.csproj b/src/Core/API/API.Core/API.Core.csproj index 55b89d1..79d1cc4 100644 --- a/src/Core/API/API.Core/API.Core.csproj +++ b/src/Core/API/API.Core/API.Core.csproj @@ -19,7 +19,9 @@ - + + diff --git a/src/Core/API/API.Core/Dockerfile b/src/Core/API/API.Core/Dockerfile index 7376967..0d7c7e1 100644 --- a/src/Core/API/API.Core/Dockerfile +++ b/src/Core/API/API.Core/Dockerfile @@ -9,7 +9,10 @@ FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["API/API.Core/API.Core.csproj", "API/API.Core/"] -COPY ["Repository/Repository.Core/Repository.Core.csproj", "Repository/Repository.Core/"] +COPY ["Domain/Domain.csproj", "Domain/"] +COPY ["Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj", "Infrastructure/Infrastructure.Repository/Repository.Core/"] +COPY ["Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj", "Infrastructure/Infrastructure.Jwt/"] +COPY ["Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj", "Infrastructure/Infrastructure.PasswordHashing/"] COPY ["Service/Service.Core/Service.Core.csproj", "Service/Service.Core/"] RUN dotnet restore "API/API.Core/API.Core.csproj" COPY . . diff --git a/src/Core/API/API.Specs/Dockerfile b/src/Core/API/API.Specs/Dockerfile index 97139c9..2324cf4 100644 --- a/src/Core/API/API.Specs/Dockerfile +++ b/src/Core/API/API.Specs/Dockerfile @@ -3,7 +3,10 @@ ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["API/API.Core/API.Core.csproj", "API/API.Core/"] COPY ["API/API.Specs/API.Specs.csproj", "API/API.Specs/"] -COPY ["Repository/Repository.Core/Repository.Core.csproj", "Repository/Repository.Core/"] +COPY ["Domain/Domain.csproj", "Domain/"] +COPY ["Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj", "Infrastructure/Infrastructure.Repository/Repository.Core/"] +COPY ["Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj", "Infrastructure/Infrastructure.Jwt/"] +COPY ["Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj", "Infrastructure/Infrastructure.PasswordHashing/"] COPY ["Service/Service.Core/Service.Core.csproj", "Service/Service.Core/"] RUN dotnet restore "API/API.Specs/API.Specs.csproj" COPY . . diff --git a/src/Core/Core.slnx b/src/Core/Core.slnx index 8555a8f..00eb33e 100644 --- a/src/Core/Core.slnx +++ b/src/Core/Core.slnx @@ -10,9 +10,13 @@ - - - + + + + + diff --git a/src/Core/Database/Database.Seed/Database.Seed.csproj b/src/Core/Database/Database.Seed/Database.Seed.csproj index 16493b5..0deeae4 100644 --- a/src/Core/Database/Database.Seed/Database.Seed.csproj +++ b/src/Core/Database/Database.Seed/Database.Seed.csproj @@ -19,6 +19,7 @@ - + diff --git a/src/Core/Service/Service.Core/Jwt/IJwtService.cs b/src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs similarity index 100% rename from src/Core/Service/Service.Core/Jwt/IJwtService.cs rename to src/Core/Infrastructure/Infrastructure.Jwt/IJwtService.cs diff --git a/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj b/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj new file mode 100644 index 0000000..c7fc3ad --- /dev/null +++ b/src/Core/Infrastructure/Infrastructure.Jwt/Infrastructure.Jwt.csproj @@ -0,0 +1,13 @@ + + + net10.0 + enable + enable + Service.Core.Jwt + + + + + + + diff --git a/src/Core/Service/Service.Core/Jwt/JwtService.cs b/src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs similarity index 100% rename from src/Core/Service/Service.Core/Jwt/JwtService.cs rename to src/Core/Infrastructure/Infrastructure.Jwt/JwtService.cs diff --git a/src/Core/Service/Service.Core/Password/IPasswordService.cs b/src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordService.cs similarity index 100% rename from src/Core/Service/Service.Core/Password/IPasswordService.cs rename to src/Core/Infrastructure/Infrastructure.PasswordHashing/IPasswordService.cs diff --git a/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj new file mode 100644 index 0000000..acf2e50 --- /dev/null +++ b/src/Core/Infrastructure/Infrastructure.PasswordHashing/Infrastructure.PasswordHashing.csproj @@ -0,0 +1,12 @@ + + + net10.0 + enable + enable + Service.Core.Password + + + + + + diff --git a/src/Core/Service/Service.Core/Password/PasswordService.cs b/src/Core/Infrastructure/Infrastructure.PasswordHashing/PasswordService.cs similarity index 100% rename from src/Core/Service/Service.Core/Password/PasswordService.cs rename to src/Core/Infrastructure/Infrastructure.PasswordHashing/PasswordService.cs diff --git a/src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Auth/AuthRepository.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Repositories/Auth/AuthRepository.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Auth/AuthRepository.cs diff --git a/src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Auth/IAuthRepository.cs diff --git a/src/Core/Repository/Repository.Core/Repositories/Repository.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Repository.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Repositories/Repository.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/Repository.cs diff --git a/src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/UserAccount/IUserAccountRepository.cs diff --git a/src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repositories/UserAccount/UserAccountRepository.cs diff --git a/src/Core/Repository/Repository.Core/Repository.Core.csproj b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj similarity index 91% rename from src/Core/Repository/Repository.Core/Repository.Core.csproj rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj index 6c69c3a..1a3107a 100644 --- a/src/Core/Repository/Repository.Core/Repository.Core.csproj +++ b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj @@ -15,6 +15,6 @@ - + diff --git a/src/Core/Repository/Repository.Core/Sql/DefaultSqlConnectionFactory.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/DefaultSqlConnectionFactory.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Sql/DefaultSqlConnectionFactory.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/DefaultSqlConnectionFactory.cs diff --git a/src/Core/Repository/Repository.Core/Sql/ISqlConnectionFactory.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/ISqlConnectionFactory.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Sql/ISqlConnectionFactory.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/ISqlConnectionFactory.cs diff --git a/src/Core/Repository/Repository.Core/Sql/SqlConnectionStringHelper.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/SqlConnectionStringHelper.cs similarity index 100% rename from src/Core/Repository/Repository.Core/Sql/SqlConnectionStringHelper.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Core/Sql/SqlConnectionStringHelper.cs diff --git a/src/Core/Repository/Repository.Tests/Auth/AuthRepository.test.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Auth/AuthRepository.test.cs similarity index 100% rename from src/Core/Repository/Repository.Tests/Auth/AuthRepository.test.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Auth/AuthRepository.test.cs diff --git a/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Dockerfile b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Dockerfile new file mode 100644 index 0000000..be8f45c --- /dev/null +++ b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Dockerfile @@ -0,0 +1,15 @@ +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Domain/Domain.csproj", "Domain/"] +COPY ["Infrastructure/Infrastructure.Repository/Repository.Core/Repository.Core.csproj", "Infrastructure/Infrastructure.Repository/Repository.Core/"] +COPY ["Infrastructure/Infrastructure.Repository/Repository.Tests/Repository.Tests.csproj", "Infrastructure/Infrastructure.Repository/Repository.Tests/"] +RUN dotnet restore "Infrastructure/Infrastructure.Repository/Repository.Tests/Repository.Tests.csproj" +COPY . . +WORKDIR "/src/Infrastructure/Infrastructure.Repository/Repository.Tests" +RUN dotnet build "./Repository.Tests.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS final +RUN mkdir -p /app/test-results +WORKDIR /src/Infrastructure/Infrastructure.Repository/Repository.Tests +ENTRYPOINT ["dotnet", "test", "./Repository.Tests.csproj", "-c", "Release", "--logger", "trx;LogFileName=/app/test-results/repository-tests.trx"] diff --git a/src/Core/Repository/Repository.Tests/Repository.Tests.csproj b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Repository.Tests.csproj similarity index 100% rename from src/Core/Repository/Repository.Tests/Repository.Tests.csproj rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/Repository.Tests.csproj diff --git a/src/Core/Repository/Repository.Tests/UserAccount/UserAccountRepository.test.cs b/src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/UserAccount/UserAccountRepository.test.cs similarity index 100% rename from src/Core/Repository/Repository.Tests/UserAccount/UserAccountRepository.test.cs rename to src/Core/Infrastructure/Infrastructure.Repository/Repository.Tests/UserAccount/UserAccountRepository.test.cs diff --git a/src/Core/Repository/Repository.Tests/Database/TestConnectionFactory.cs b/src/Core/Repository/Repository.Tests/Database/TestConnectionFactory.cs deleted file mode 100644 index dc15914..0000000 --- a/src/Core/Repository/Repository.Tests/Database/TestConnectionFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Data.Common; -using Repository.Core.Sql; - -namespace Repository.Tests.Database; - -internal class TestConnectionFactory(DbConnection conn) : ISqlConnectionFactory -{ - private readonly DbConnection _conn = conn; - public DbConnection CreateConnection() => _conn; -} diff --git a/src/Core/Repository/Repository.Tests/Dockerfile b/src/Core/Repository/Repository.Tests/Dockerfile deleted file mode 100644 index 4b83399..0000000 --- a/src/Core/Repository/Repository.Tests/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["Repository/Repository.Core/Repository.Core.csproj", "Repository/Repository.Core/"] -COPY ["Repository/Repository.Tests/Repository.Tests.csproj", "Repository/Repository.Tests/"] -RUN dotnet restore "Repository/Repository.Tests/Repository.Tests.csproj" -COPY . . -WORKDIR "/src/Repository/Repository.Tests" -RUN dotnet build "./Repository.Tests.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS final -RUN mkdir -p /app/test-results -WORKDIR /src/Repository/Repository.Tests -ENTRYPOINT ["dotnet", "test", "./Repository.Tests.csproj", "-c", "Release", "--logger", "trx;LogFileName=/app/test-results/repository-tests.trx"] diff --git a/src/Core/Service/Service.Core/Service.Core.csproj b/src/Core/Service/Service.Core/Service.Core.csproj index 9ce9012..595fd7d 100644 --- a/src/Core/Service/Service.Core/Service.Core.csproj +++ b/src/Core/Service/Service.Core/Service.Core.csproj @@ -12,6 +12,9 @@ - + +