mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
Move Infrastructure.FileUpload into Features.PhotoUpload (#290)
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
<ProjectReference Include="..\..\Domain\Domain.Exceptions\Domain.Exceptions.csproj" />
|
||||
<ProjectReference Include="..\..\Database\Database.Connection\Database.Connection.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Infrastructure.Configuration\Infrastructure.Configuration.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Infrastructure.FileUpload\Infrastructure.FileUpload.csproj" />
|
||||
<ProjectReference Include="..\..\Features\Features.Breweries\Features.Breweries.csproj" />
|
||||
<ProjectReference Include="..\..\Features\Features.Users\Features.Users.csproj" />
|
||||
<ProjectReference Include="..\..\Features\Features.Emails\Features.Emails.csproj" />
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<IFileStorageProvider, S3FileStorageProvider>()
|
||||
.AddScoped<GlobalExceptionFilter>();
|
||||
services.AddScoped<GlobalExceptionFilter>();
|
||||
|
||||
public IServiceCollection AddJwtAuthentication()
|
||||
{
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
</Folder>
|
||||
<Folder Name="/Infrastructure/">
|
||||
<Project Path="Infrastructure/Infrastructure.Configuration/Infrastructure.Configuration.csproj" />
|
||||
<Project Path="Infrastructure/Infrastructure.FileUpload/Infrastructure.FileUpload.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/Features/" />
|
||||
<Folder Name="/Features/Users/">
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
<ProjectReference Include="..\..\Features\Features.Users\Features.Users.csproj" />
|
||||
<ProjectReference Include="..\..\Features\Features.Locations\Features.Locations.csproj" />
|
||||
<ProjectReference Include="..\..\Features\Features.PhotoUpload\Features.PhotoUpload.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Infrastructure.FileUpload\Infrastructure.FileUpload.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None
|
||||
|
||||
@@ -10,7 +10,6 @@ using Features.Locations.Queries.GetCountry;
|
||||
using Features.Users.Commands.Profile.UploadAvatar;
|
||||
using Features.Users.DependencyInjection;
|
||||
using Features.Users.Services;
|
||||
using Infrastructure.FileUpload;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -31,7 +30,6 @@ internal class Program
|
||||
.AddFeaturesLocations()
|
||||
.AddFeaturesUsers()
|
||||
.AddFeaturesPhotoUpload()
|
||||
.AddSingleton<IFileStorageProvider, S3FileStorageProvider>()
|
||||
.AddScoped<ITokenService, NoOpTokenService>()
|
||||
.AddMediatR(cfg =>
|
||||
cfg.RegisterServicesFromAssemblyContaining<CreateBreweryCommand>()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
/// <summary>Registers the services required by the PhotoUpload feature.</summary>
|
||||
public static class FeaturesPhotoUploadServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>Registers <see cref="IPhotoUploadRepository" /> and its implementation.</summary>
|
||||
/// <summary>
|
||||
/// Registers <see cref="IPhotoUploadRepository" /> and <see cref="IFileStorageProvider" /> and their
|
||||
/// implementations.
|
||||
/// </summary>
|
||||
/// <returns><paramref name="services" />, for chaining.</returns>
|
||||
public static IServiceCollection AddFeaturesPhotoUpload(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<IPhotoUploadRepository, PhotoUploadRepository>();
|
||||
services
|
||||
.AddScoped<IPhotoUploadRepository, PhotoUploadRepository>()
|
||||
.AddSingleton<IFileStorageProvider, S3FileStorageProvider>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,19 @@
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="4.0.102.4" />
|
||||
<PackageReference
|
||||
Include="Microsoft.Extensions.Configuration.Abstractions"
|
||||
Version="10.0.1"
|
||||
/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Domain\Domain.Entities\Domain.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\Domain\Domain.Exceptions\Domain.Exceptions.csproj" />
|
||||
<ProjectReference Include="..\..\Database\Database.Connection\Database.Connection.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Infrastructure.FileUpload\Infrastructure.FileUpload.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Infrastructure.Configuration\Infrastructure.Configuration.csproj" />
|
||||
<ProjectReference Include="..\..\Shared\Shared.Contracts\Shared.Contracts.csproj" />
|
||||
<ProjectReference Include="..\..\Shared\Shared.Application\Shared.Application.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Infrastructure.FileUpload;
|
||||
namespace Features.ImageUploads.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for storing and retrieving uploaded files in S3-compatible object storage.
|
||||
@@ -3,7 +3,7 @@ using Amazon.S3.Model;
|
||||
using Infrastructure.Configuration;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Infrastructure.FileUpload;
|
||||
namespace Features.ImageUploads.Services;
|
||||
|
||||
/// <summary>
|
||||
/// File storage service backed by an S3-compatible object store (e.g. SeaweedFS, AWS S3).
|
||||
@@ -1,20 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Infrastructure.FileUpload</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="4.0.102.4" />
|
||||
<PackageReference
|
||||
Include="Microsoft.Extensions.Configuration.Abstractions"
|
||||
Version="10.0.1"
|
||||
/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Infrastructure.Configuration\Infrastructure.Configuration.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user