diff --git a/docs/web/architecture.md b/docs/web/architecture.md index be1d04cd..c7e5291c 100644 --- a/docs/web/architecture.md +++ b/docs/web/architecture.md @@ -91,7 +91,6 @@ flowchart TB I1["Database.Connection"] I3["Infrastructure.PasswordHashing"] I4["Email.Templates"] - I5["Infrastructure.FileUpload"] end DB[("Database (SQL Server)")] @@ -166,8 +165,7 @@ brewery photo upload command) rather than bound to an HTTP route directly. - `Domain.Entities`, `Domain.Exceptions` - `Database.Connection` (generic ADO.NET connection/command plumbing) plus whichever infrastructure project the slice needs (`Infrastructure.PasswordHashing` - for Users, `Infrastructure.Email.Templates` for - Emails, `Infrastructure.FileUpload` for PhotoUpload) + for Users, `Infrastructure.Email.Templates` for Emails) - `Shared.Contracts`, `Shared.Application` - No other `Features.*` project, with two exceptions: `Features.Users` references `Features.PhotoUpload` directly for avatar uploads, and @@ -209,7 +207,6 @@ whichever slices need them | `Database.Connection` | Generic ADO.NET connection/command plumbing (`DefaultSqlConnectionFactory`, the abstract `DapperRepository` base class), not domain-specific; each slice's own `Repository/` folder builds on this. | | `Infrastructure.PasswordHashing` | Argon2id password hashing. | | `Infrastructure.Email.Templates` | Email template rendering (Razor components). | -| `Infrastructure.FileUpload` | `IFileStorageProvider` abstraction over S3-compatible object storage, implemented by `S3FileStorageProvider` (targets the SeaweedFS container in dev; any S3-compatible endpoint in other environments) using the AWS SDK's `AmazonS3Client` with `ForcePathStyle = true`. | **Dependencies**: diff --git a/docs/web/diagrams/vertical-slice.md b/docs/web/diagrams/vertical-slice.md index c6febf87..2963d7c8 100644 --- a/docs/web/diagrams/vertical-slice.md +++ b/docs/web/diagrams/vertical-slice.md @@ -99,7 +99,7 @@ see the notes for what else each of those foundation projects pulls in. - `Domain.Exceptions` (referenced by nearly every project directly, including all of `Shared.Contracts` and each feature slice) - `Infrastructure.Configuration` (the shared options-binding project - referenced by `Database.Connection`, `Infrastructure.FileUpload`, + referenced by `Database.Connection`, `Features.PhotoUpload`, and `Features.Emails` directly) - both are plumbing-level dependencies of nearly everything above, and drawing them would just add a second copy of the same fan-in diff --git a/docs/web/diagrams/vertical-slice/project-references.mmd b/docs/web/diagrams/vertical-slice/project-references.mmd index ac7ce73c..ed4eb20d 100644 --- a/docs/web/diagrams/vertical-slice/project-references.mmd +++ b/docs/web/diagrams/vertical-slice/project-references.mmd @@ -24,7 +24,6 @@ end subgraph INFRA["Slice-specific Infrastructure"] direction LR PwdHash["Infrastructure.PasswordHashing"] -FileUpload["Infrastructure.FileUpload"] EmailTemplates["Infrastructure.Email.Templates"] end @@ -33,7 +32,7 @@ EmailsSlice == project ref, handles UserRegisteredNotification & ConfirmationEma BrewerySlice --> FOUNDATION LocationsSlice --> FOUNDATION BeersSlice --> FOUNDATION -PhotoSlice --> FOUNDATION & FileUpload +PhotoSlice --> FOUNDATION UsersSlice --> FOUNDATION & PwdHash EmailsSlice --> EmailTemplates DBConn -- Dapper SQL, no ORM --> Tables[("SQL Server
Tables")] diff --git a/docs/web/environment-variables.md b/docs/web/environment-variables.md index 1dc59dc6..d47afe53 100644 --- a/docs/web/environment-variables.md +++ b/docs/web/environment-variables.md @@ -255,8 +255,8 @@ SMTP_FROM_NAME=The Biergarten App # Optional, defaults to "The Biergarten ### File storage configuration (backend) -Read by `Infrastructure.FileUpload/S3FileStorageProvider.cs` for uploading and -retrieving photos via an S3-compatible object store. +Read by `Features.PhotoUpload/Services/S3FileStorageProvider.cs` for uploading +and retrieving photos via an S3-compatible object store. ```bash SEAWEEDFS_SERVICE_URL=http://seaweedfs:8333 # Required, no default diff --git a/web/backend/API/API.Core/API.Core.csproj b/web/backend/API/API.Core/API.Core.csproj index 4e4abe30..de6ff688 100644 --- a/web/backend/API/API.Core/API.Core.csproj +++ b/web/backend/API/API.Core/API.Core.csproj @@ -23,7 +23,6 @@ - diff --git a/web/backend/API/API.Core/Dockerfile b/web/backend/API/API.Core/Dockerfile index dbf2cb71..3b88389f 100644 --- a/web/backend/API/API.Core/Dockerfile +++ b/web/backend/API/API.Core/Dockerfile @@ -34,7 +34,6 @@ COPY ["Features/Features.PhotoUpload.Tests/Features.PhotoUpload.Tests.csproj", " COPY ["Features/Features.Users/Features.Users.csproj", "Features/Features.Users/"] COPY ["Features/Features.Users.Tests/Features.Users.Tests.csproj", "Features/Features.Users.Tests/"] COPY ["Infrastructure/Infrastructure.Configuration/Infrastructure.Configuration.csproj", "Infrastructure/Infrastructure.Configuration/"] -COPY ["Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj", "Infrastructure/Infrastructure.FileUpload/"] COPY ["Shared/Shared.Application/Shared.Application.csproj", "Shared/Shared.Application/"] COPY ["Shared/Shared.Contracts/Shared.Contracts.csproj", "Shared/Shared.Contracts/"] RUN dotnet restore "Biergarten.API.slnx" diff --git a/web/backend/API/API.Core/ServiceCollectionExtensions.cs b/web/backend/API/API.Core/ServiceCollectionExtensions.cs index d8d01a8c..3f168f89 100644 --- a/web/backend/API/API.Core/ServiceCollectionExtensions.cs +++ b/web/backend/API/API.Core/ServiceCollectionExtensions.cs @@ -12,7 +12,6 @@ using Features.Users.Controllers; using Features.Users.DependencyInjection; using FluentValidation; using FluentValidation.AspNetCore; -using Infrastructure.FileUpload; using Microsoft.OpenApi.Models; using Shared.Application.Behaviors; @@ -103,9 +102,7 @@ internal static class ServiceCollectionExtensions .AddFeaturesLocations(); public IServiceCollection AddCoreInfrastructure() => - services - .AddSingleton() - .AddScoped(); + services.AddScoped(); public IServiceCollection AddJwtAuthentication() { diff --git a/web/backend/API/API.Specs/Dockerfile b/web/backend/API/API.Specs/Dockerfile index 97033c14..bb708481 100644 --- a/web/backend/API/API.Specs/Dockerfile +++ b/web/backend/API/API.Specs/Dockerfile @@ -24,7 +24,6 @@ COPY ["Features/Features.PhotoUpload.Tests/Features.PhotoUpload.Tests.csproj", " COPY ["Features/Features.Users/Features.Users.csproj", "Features/Features.Users/"] COPY ["Features/Features.Users.Tests/Features.Users.Tests.csproj", "Features/Features.Users.Tests/"] COPY ["Infrastructure/Infrastructure.Configuration/Infrastructure.Configuration.csproj", "Infrastructure/Infrastructure.Configuration/"] -COPY ["Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj", "Infrastructure/Infrastructure.FileUpload/"] COPY ["Shared/Shared.Application/Shared.Application.csproj", "Shared/Shared.Application/"] COPY ["Shared/Shared.Contracts/Shared.Contracts.csproj", "Shared/Shared.Contracts/"] RUN dotnet restore "Biergarten.API.slnx" diff --git a/web/backend/Biergarten.API.slnx b/web/backend/Biergarten.API.slnx index 415a0b56..674edbb0 100644 --- a/web/backend/Biergarten.API.slnx +++ b/web/backend/Biergarten.API.slnx @@ -21,7 +21,6 @@ - diff --git a/web/backend/Database/Database.Seed/Database.Seed.csproj b/web/backend/Database/Database.Seed/Database.Seed.csproj index ed9aae72..3e306666 100644 --- a/web/backend/Database/Database.Seed/Database.Seed.csproj +++ b/web/backend/Database/Database.Seed/Database.Seed.csproj @@ -24,7 +24,6 @@ - () .AddScoped() .AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining() diff --git a/web/backend/Features/Features.PhotoUpload.Tests/Commands/UploadPhotoHandlerTests.cs b/web/backend/Features/Features.PhotoUpload.Tests/Commands/UploadPhotoHandlerTests.cs index ad2d69a3..a643bfb6 100644 --- a/web/backend/Features/Features.PhotoUpload.Tests/Commands/UploadPhotoHandlerTests.cs +++ b/web/backend/Features/Features.PhotoUpload.Tests/Commands/UploadPhotoHandlerTests.cs @@ -1,8 +1,8 @@ using Domain.Entities; using Features.ImageUploads.Commands.UploadPhoto; using Features.ImageUploads.Repository; +using Features.ImageUploads.Services; using FluentAssertions; -using Infrastructure.FileUpload; using Microsoft.AspNetCore.Http; using Moq; diff --git a/web/backend/Features/Features.PhotoUpload/Commands/UploadPhoto/UploadPhotoHandler.cs b/web/backend/Features/Features.PhotoUpload/Commands/UploadPhoto/UploadPhotoHandler.cs index d857f2cd..9fce4186 100644 --- a/web/backend/Features/Features.PhotoUpload/Commands/UploadPhoto/UploadPhotoHandler.cs +++ b/web/backend/Features/Features.PhotoUpload/Commands/UploadPhoto/UploadPhotoHandler.cs @@ -1,6 +1,6 @@ using Domain.Entities; using Features.ImageUploads.Repository; -using Infrastructure.FileUpload; +using Features.ImageUploads.Services; using MediatR; namespace Features.ImageUploads.Commands.UploadPhoto; diff --git a/web/backend/Features/Features.PhotoUpload/DependencyInjection/FeaturesPhotoUploadServiceCollectionExtensions.cs b/web/backend/Features/Features.PhotoUpload/DependencyInjection/FeaturesPhotoUploadServiceCollectionExtensions.cs index 6e0a698d..dac4d8a5 100644 --- a/web/backend/Features/Features.PhotoUpload/DependencyInjection/FeaturesPhotoUploadServiceCollectionExtensions.cs +++ b/web/backend/Features/Features.PhotoUpload/DependencyInjection/FeaturesPhotoUploadServiceCollectionExtensions.cs @@ -1,4 +1,5 @@ using Features.ImageUploads.Repository; +using Features.ImageUploads.Services; using Microsoft.Extensions.DependencyInjection; namespace Features.ImageUploads.DependencyInjection; @@ -6,11 +7,16 @@ namespace Features.ImageUploads.DependencyInjection; /// Registers the services required by the PhotoUpload feature. public static class FeaturesPhotoUploadServiceCollectionExtensions { - /// Registers and its implementation. + /// + /// Registers and and their + /// implementations. + /// /// , for chaining. public static IServiceCollection AddFeaturesPhotoUpload(this IServiceCollection services) { - services.AddScoped(); + services + .AddScoped() + .AddSingleton(); return services; } } diff --git a/web/backend/Features/Features.PhotoUpload/Features.PhotoUpload.csproj b/web/backend/Features/Features.PhotoUpload/Features.PhotoUpload.csproj index 64b3c805..31659a75 100644 --- a/web/backend/Features/Features.PhotoUpload/Features.PhotoUpload.csproj +++ b/web/backend/Features/Features.PhotoUpload/Features.PhotoUpload.csproj @@ -10,11 +10,19 @@ + + + + + - + diff --git a/web/backend/Infrastructure/Infrastructure.FileUpload/IFileStorageProvider.cs b/web/backend/Features/Features.PhotoUpload/Services/IFileStorageProvider.cs similarity index 96% rename from web/backend/Infrastructure/Infrastructure.FileUpload/IFileStorageProvider.cs rename to web/backend/Features/Features.PhotoUpload/Services/IFileStorageProvider.cs index 106e3a60..b7612b49 100644 --- a/web/backend/Infrastructure/Infrastructure.FileUpload/IFileStorageProvider.cs +++ b/web/backend/Features/Features.PhotoUpload/Services/IFileStorageProvider.cs @@ -1,4 +1,4 @@ -namespace Infrastructure.FileUpload; +namespace Features.ImageUploads.Services; /// /// Service for storing and retrieving uploaded files in S3-compatible object storage. diff --git a/web/backend/Infrastructure/Infrastructure.FileUpload/S3FileStorageProvider.cs b/web/backend/Features/Features.PhotoUpload/Services/S3FileStorageProvider.cs similarity index 98% rename from web/backend/Infrastructure/Infrastructure.FileUpload/S3FileStorageProvider.cs rename to web/backend/Features/Features.PhotoUpload/Services/S3FileStorageProvider.cs index 74d4a3ea..ccbe0b7f 100644 --- a/web/backend/Infrastructure/Infrastructure.FileUpload/S3FileStorageProvider.cs +++ b/web/backend/Features/Features.PhotoUpload/Services/S3FileStorageProvider.cs @@ -3,7 +3,7 @@ using Amazon.S3.Model; using Infrastructure.Configuration; using Microsoft.Extensions.Configuration; -namespace Infrastructure.FileUpload; +namespace Features.ImageUploads.Services; /// /// File storage service backed by an S3-compatible object store (e.g. SeaweedFS, AWS S3). diff --git a/web/backend/Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj b/web/backend/Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj deleted file mode 100644 index 9308d863..00000000 --- a/web/backend/Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - net10.0 - enable - enable - Infrastructure.FileUpload - - - - - - - - - - -