From 573a0f6e3f05d02eac3d9f84ccdb23ad9f1c80fa Mon Sep 17 00:00:00 2001 From: gamer147 Date: Sat, 22 Nov 2025 22:36:44 -0500 Subject: [PATCH] [FA-5] FileService setup, build scripts tweaked to be easier to maintain --- FictionArchive.API/build_gateway.bat | 99 ------------- FictionArchive.API/build_gateway.ps1 | 138 ++++++++++++++++++ FictionArchive.API/build_gateway.sh | 16 +- FictionArchive.API/gateway_skip.txt | 4 + FictionArchive.Common/Enums/RequestStatus.cs | 8 + .../Controllers/S3ProxyController.cs | 49 +++++++ FictionArchive.Service.FileService/Dockerfile | 23 +++ .../FictionArchive.Service.FileService.csproj | 30 ++++ .../FileUploadRequestCreatedEvent.cs | 10 ++ .../FileUploadRequestStatusUpdate.cs | 22 +++ .../Models/ProxyConfiguration.cs | 6 + .../Models/S3Configuration.cs | 9 ++ FictionArchive.Service.FileService/Program.cs | 66 +++++++++ .../Properties/launchSettings.json | 39 +++++ .../FileUploadRequestCreatedEventHandler.cs | 57 ++++++++ .../appsettings.Development.json | 8 + .../appsettings.json | 22 +++ .../FileUploadRequestCreatedEvent.cs | 10 ++ FictionArchive.sln | 6 + 19 files changed, 519 insertions(+), 103 deletions(-) delete mode 100644 FictionArchive.API/build_gateway.bat create mode 100644 FictionArchive.API/build_gateway.ps1 create mode 100644 FictionArchive.API/gateway_skip.txt create mode 100644 FictionArchive.Common/Enums/RequestStatus.cs create mode 100644 FictionArchive.Service.FileService/Controllers/S3ProxyController.cs create mode 100644 FictionArchive.Service.FileService/Dockerfile create mode 100644 FictionArchive.Service.FileService/FictionArchive.Service.FileService.csproj create mode 100644 FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs create mode 100644 FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestStatusUpdate.cs create mode 100644 FictionArchive.Service.FileService/Models/ProxyConfiguration.cs create mode 100644 FictionArchive.Service.FileService/Models/S3Configuration.cs create mode 100644 FictionArchive.Service.FileService/Program.cs create mode 100644 FictionArchive.Service.FileService/Properties/launchSettings.json create mode 100644 FictionArchive.Service.FileService/Services/EventHandlers/FileUploadRequestCreatedEventHandler.cs create mode 100644 FictionArchive.Service.FileService/appsettings.Development.json create mode 100644 FictionArchive.Service.FileService/appsettings.json create mode 100644 FictionArchive.Service.NovelService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs diff --git a/FictionArchive.API/build_gateway.bat b/FictionArchive.API/build_gateway.bat deleted file mode 100644 index 598d0e6..0000000 --- a/FictionArchive.API/build_gateway.bat +++ /dev/null @@ -1,99 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -set ROOT=%~dp0 - -for %%A in ("%ROOT%..") do set SERVICES_DIR=%%~fA\ - -REM ---------------------------------------- -REM List of project names to skip -REM (space-separated, match folder names exactly) -REM ---------------------------------------- -set SKIP_PROJECTS=FictionArchive.Service.Shared FictionArchive.Service.AuthenticationService - -echo ---------------------------------------- -echo Finding GraphQL services... -echo ---------------------------------------- - -set SERVICE_LIST= - -for /d %%F in ("%SERVICES_DIR%FictionArchive.Service.*") do ( - set "PROJECT_NAME=%%~nxF" - set "SKIP=0" - - REM Check if this project name is in the skip list - for %%X in (%SKIP_PROJECTS%) do ( - if /I "!PROJECT_NAME!"=="%%X" ( - set "SKIP=1" - ) - ) - - if !SKIP!==0 ( - echo Found service: !PROJECT_NAME! - set SERVICE_LIST=!SERVICE_LIST! %%F - ) else ( - echo Skipping service: !PROJECT_NAME! - ) -) - -echo: -echo ---------------------------------------- -echo Exporting schemas and packing subgraphs... -echo ---------------------------------------- - -for %%S in (%SERVICE_LIST%) do ( - echo Processing service folder: %%S - pushd "%%S" - - echo Running schema export... - dotnet run -- schema export --output schema.graphql - if errorlevel 1 ( - echo ERROR during schema export in %%S - popd - exit /b 1 - ) - - echo Running fusion subgraph pack... - fusion subgraph pack - if errorlevel 1 ( - echo ERROR during subgraph pack in %%S - popd - exit /b 1 - ) - - popd - echo Completed: %%S - echo. -) - -echo ---------------------------------------- -echo Running fusion compose... -echo ---------------------------------------- - -pushd "%ROOT%" - -if exist gateway.fgp del gateway.fgp - -for %%S in (%SERVICE_LIST%) do ( - REM Extract the full folder name WITH dots preserved - set "SERVICE_NAME=%%~nxS" - - echo Composing subgraph: !SERVICE_NAME! - - fusion compose -p gateway.fgp -s "..\!SERVICE_NAME!" - if errorlevel 1 ( - echo ERROR during fusion compose - popd - exit /b 1 - ) -) - -popd - - -echo ---------------------------------------- -echo Fusion build complete! -echo ---------------------------------------- - -endlocal -exit /b 0 diff --git a/FictionArchive.API/build_gateway.ps1 b/FictionArchive.API/build_gateway.ps1 new file mode 100644 index 0000000..f06ddf0 --- /dev/null +++ b/FictionArchive.API/build_gateway.ps1 @@ -0,0 +1,138 @@ +<# +.SYNOPSIS + Export GraphQL schemas, pack subgraphs and compose the gateway (PowerShell). +.DESCRIPTION + - Searches for FictionArchive.Service.* folders one directory above this script. + - Reads skip-projects.txt next to the script. + - Builds each service (Release). + - Runs `dotnet run --no-build --no-launch-profile -- schema export` in each service to avoid running the web host. + - Packs subgraphs. + - Composes the gateway from FictionArchive.API. +#> + +[CmdletBinding()] +param() + +function Write-ErrExit { + param($Message, $Code = 1) + Write-Error $Message + exit $Code +} + +# Resolve directories +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$ServicesDir = Resolve-Path -Path (Join-Path $ScriptDir '..') -ErrorAction Stop +$ApiDir = Join-Path $ServicesDir 'FictionArchive.API' + +Write-Host "Script dir: $ScriptDir" +Write-Host "Services dir: $ServicesDir" + +# Load skip list +$SkipFile = Join-Path $ScriptDir 'gateway_skip.txt' +$SkipList = @() + +Write-Host "----------------------------------------" +Write-Host " Loading skip list..." +Write-Host "----------------------------------------" + +if (Test-Path $SkipFile) { + $SkipList = Get-Content $SkipFile | + ForEach-Object { $_.Trim() } | + Where-Object { $_ -and -not $_.StartsWith('#') } + + Write-Host "Skipping: $($SkipList -join ', ')" +} else { + Write-Warning "skip-projects.txt not found — no services will be skipped." +} + +# Find service directories +Write-Host +Write-Host "----------------------------------------" +Write-Host " Finding GraphQL services..." +Write-Host "----------------------------------------" + +$servicePattern = 'FictionArchive.Service.*' +$serviceDirs = Get-ChildItem -Path $ServicesDir -Directory -Filter 'FictionArchive.Service.*' + +if (-not $serviceDirs) { + Write-ErrExit "No service folders found matching FictionArchive.Service.* under $ServicesDir" +} + +$selectedServices = @() + +foreach ($d in $serviceDirs) { + if ($SkipList -contains $d.Name) { + Write-Host "Skipping: $($d.Name)" + continue + } + + Write-Host "Found: $($d.Name)" + $selectedServices += $d.FullName +} + +if (-not $selectedServices) { + Write-ErrExit "All services skipped — nothing to do." +} + +# Export schemas and pack subgraphs +Write-Host +Write-Host "----------------------------------------" +Write-Host " Exporting schemas & packing subgraphs..." +Write-Host "----------------------------------------" + +foreach ($svcPath in $selectedServices) { + $svcName = Split-Path -Leaf $svcPath + Write-Host "`nProcessing: $svcName" + + Push-Location $svcPath + try { + # Build Release + Write-Host "Building $svcName..." + dotnet build -c Release + if ($LASTEXITCODE -ne 0) { Write-ErrExit "dotnet build failed for $svcName" } + + # Schema export using dotnet run (no server) + Write-Host "Running schema export..." + dotnet run --no-build --no-launch-profile -- schema export --output schema.graphql + if ($LASTEXITCODE -ne 0) { Write-ErrExit "Schema export failed for $svcName" } + + # Pack subgraph + Write-Host "Running fusion subgraph pack..." + fusion subgraph pack + if ($LASTEXITCODE -ne 0) { Write-ErrExit "fusion subgraph pack failed for $svcName" } + + Write-Host "Completed: $svcName" + } + finally { + Pop-Location + } +} + +# Compose gateway +Write-Host +Write-Host "----------------------------------------" +Write-Host " Running fusion compose..." +Write-Host "----------------------------------------" + +if (-not (Test-Path $ApiDir)) { + Write-ErrExit "API directory not found: $ApiDir" +} + +Push-Location $ApiDir +try { + if (Test-Path "gateway.fgp") { Remove-Item "gateway.fgp" -Force } + + foreach ($svcPath in $selectedServices) { + $svcName = Split-Path -Leaf $svcPath + Write-Host "Composing: $svcName" + fusion compose -p gateway.fgp -s ("..\" + $svcName) + if ($LASTEXITCODE -ne 0) { Write-ErrExit "fusion compose failed for $svcName" } + } + + Write-Host "`nFusion build complete!" +} +finally { + Pop-Location +} + +exit 0 diff --git a/FictionArchive.API/build_gateway.sh b/FictionArchive.API/build_gateway.sh index f6ed69a..3a30cd3 100644 --- a/FictionArchive.API/build_gateway.sh +++ b/FictionArchive.API/build_gateway.sh @@ -14,10 +14,18 @@ SERVICES_DIR="$(cd "$ROOT/.." && pwd)" ############################################### # Skip list (folder names, match exactly) ############################################### -SKIP_PROJECTS=( - "FictionArchive.Service.Shared" - "FictionArchive.Service.Legacy" -) +SKIP_FILE="$ROOT/gateway_skip.txt" +SKIP_PROJECTS=() + +if [[ -f "$SKIP_FILE" ]]; then + # Read non-empty lines ignoring comments + while IFS= read -r line; do + [[ -z "$line" || "$line" =~ ^# ]] && continue + SKIP_PROJECTS+=("$line") + done < "$SKIP_FILE" +else + echo "WARNING: skip-projects.txt not found — no projects will be skipped." +fi echo "----------------------------------------" echo " Finding GraphQL services..." diff --git a/FictionArchive.API/gateway_skip.txt b/FictionArchive.API/gateway_skip.txt new file mode 100644 index 0000000..779d6de --- /dev/null +++ b/FictionArchive.API/gateway_skip.txt @@ -0,0 +1,4 @@ +# List of service folders to skip +FictionArchive.Service.Shared +FictionArchive.Service.AuthenticationService +FictionArchive.Service.FileService diff --git a/FictionArchive.Common/Enums/RequestStatus.cs b/FictionArchive.Common/Enums/RequestStatus.cs new file mode 100644 index 0000000..9b0fedd --- /dev/null +++ b/FictionArchive.Common/Enums/RequestStatus.cs @@ -0,0 +1,8 @@ +namespace FictionArchive.Common.Enums; + +public enum RequestStatus +{ + Failed = -1, + Pending = 0, + Success = 1 +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Controllers/S3ProxyController.cs b/FictionArchive.Service.FileService/Controllers/S3ProxyController.cs new file mode 100644 index 0000000..384095b --- /dev/null +++ b/FictionArchive.Service.FileService/Controllers/S3ProxyController.cs @@ -0,0 +1,49 @@ +using System.Web; +using Amazon.S3; +using Amazon.S3.Model; +using FictionArchive.Service.FileService.Models; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; + +namespace FictionArchive.Service.FileService.Controllers +{ + [Route("api/{*path}")] + [ApiController] + public class S3ProxyController : ControllerBase + { + private readonly AmazonS3Client _amazonS3Client; + private readonly S3Configuration _s3Configuration; + + public S3ProxyController(AmazonS3Client amazonS3Client, IOptions s3Configuration) + { + _amazonS3Client = amazonS3Client; + _s3Configuration = s3Configuration.Value; + } + + [HttpGet] + public async Task Get(string path) + { + var decodedPath = HttpUtility.UrlDecode(path); + + try + { + var s3Response = await _amazonS3Client.GetObjectAsync(new GetObjectRequest() + { + BucketName = _s3Configuration.Bucket, + Key = decodedPath + }); + + return new FileStreamResult(s3Response.ResponseStream, s3Response.Headers.ContentType); + } + catch (AmazonS3Exception e) + { + if (e.Message == "Key not found") + { + return NotFound(); + } + throw; + } + } + } +} diff --git a/FictionArchive.Service.FileService/Dockerfile b/FictionArchive.Service.FileService/Dockerfile new file mode 100644 index 0000000..f972438 --- /dev/null +++ b/FictionArchive.Service.FileService/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["FictionArchive.Service.ImageService/FictionArchive.Service.ImageService.csproj", "FictionArchive.Service.ImageService/"] +RUN dotnet restore "FictionArchive.Service.ImageService/FictionArchive.Service.ImageService.csproj" +COPY . . +WORKDIR "/src/FictionArchive.Service.ImageService" +RUN dotnet build "./FictionArchive.Service.ImageService.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./FictionArchive.Service.ImageService.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "FictionArchive.Service.ImageService.dll"] diff --git a/FictionArchive.Service.FileService/FictionArchive.Service.FileService.csproj b/FictionArchive.Service.FileService/FictionArchive.Service.FileService.csproj new file mode 100644 index 0000000..7e69402 --- /dev/null +++ b/FictionArchive.Service.FileService/FictionArchive.Service.FileService.csproj @@ -0,0 +1,30 @@ + + + + net8.0 + enable + enable + Linux + + + + + .dockerignore + + + + + + + + + + + + + + + + + + diff --git a/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs b/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs new file mode 100644 index 0000000..bf03a56 --- /dev/null +++ b/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs @@ -0,0 +1,10 @@ +using FictionArchive.Service.Shared.Services.EventBus; + +namespace FictionArchive.Service.FileService.Models.IntegrationEvents; + +public class FileUploadRequestCreatedEvent : IIntegrationEvent +{ + public Guid RequestId { get; set; } + public string FilePath { get; set; } + public byte[] FileData { get; set; } +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestStatusUpdate.cs b/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestStatusUpdate.cs new file mode 100644 index 0000000..b5936de --- /dev/null +++ b/FictionArchive.Service.FileService/Models/IntegrationEvents/FileUploadRequestStatusUpdate.cs @@ -0,0 +1,22 @@ +using FictionArchive.Common.Enums; +using FictionArchive.Service.Shared.Services.EventBus; + +namespace FictionArchive.Service.FileService.Models.IntegrationEvents; + +public class FileUploadRequestStatusUpdateEvent : IIntegrationEvent +{ + public Guid RequestId { get; set; } + public RequestStatus Status { get; set; } + + #region Success + + public string? FileAccessUrl { get; set; } + + #endregion + + #region Failure + + public string? ErrorMessage { get; set; } + + #endregion +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Models/ProxyConfiguration.cs b/FictionArchive.Service.FileService/Models/ProxyConfiguration.cs new file mode 100644 index 0000000..c1ce02c --- /dev/null +++ b/FictionArchive.Service.FileService/Models/ProxyConfiguration.cs @@ -0,0 +1,6 @@ +namespace FictionArchive.Service.FileService.Models; + +public class ProxyConfiguration +{ + public string BaseUrl { get; set; } +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Models/S3Configuration.cs b/FictionArchive.Service.FileService/Models/S3Configuration.cs new file mode 100644 index 0000000..b5c601e --- /dev/null +++ b/FictionArchive.Service.FileService/Models/S3Configuration.cs @@ -0,0 +1,9 @@ +namespace FictionArchive.Service.FileService.Models; + +public class S3Configuration +{ + public string Url { get; set; } + public string Bucket { get; set; } + public string AccessKey { get; set; } + public string SecretKey { get; set; } +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Program.cs b/FictionArchive.Service.FileService/Program.cs new file mode 100644 index 0000000..ed18765 --- /dev/null +++ b/FictionArchive.Service.FileService/Program.cs @@ -0,0 +1,66 @@ +using Amazon.Runtime; +using Amazon.S3; +using FictionArchive.Common.Extensions; +using FictionArchive.Service.FileService.Models; +using FictionArchive.Service.Shared.Extensions; +using FictionArchive.Service.Shared.Services.EventBus.Implementations; +using Microsoft.Extensions.Options; + +namespace FictionArchive.Service.FileService; + +public class Program +{ + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + builder.AddLocalAppsettings(); + + builder.Services.AddControllers(); + // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle + builder.Services.AddEndpointsApiExplorer(); + builder.Services.AddSwaggerGen(); + + builder.Services.AddHealthChecks(); + + #region Event Bus + + builder.Services.AddRabbitMQ(opt => + { + builder.Configuration.GetSection("RabbitMQ").Bind(opt); + }); + + #endregion + + builder.Services.Configure(builder.Configuration.GetSection("ProxyConfiguration")); + + // Add S3 Client + builder.Services.Configure(builder.Configuration.GetSection("S3")); + builder.Services.AddSingleton(provider => + { + var config = provider.GetRequiredService>().Value; + var s3Config = new AmazonS3Config + { + ServiceURL = config.Url, // Garage endpoint + ForcePathStyle = true, // REQUIRED for Garage + AuthenticationRegion = "garage" + }; + return new AmazonS3Client( + new BasicAWSCredentials(config.AccessKey, config.SecretKey), + s3Config); + }); + + var app = builder.Build(); + + if (app.Environment.IsDevelopment()) + { + app.UseSwagger(); + app.UseSwaggerUI(); + } + + app.MapHealthChecks("/healthz"); + + app.MapControllers(); + + app.Run(); + } +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/Properties/launchSettings.json b/FictionArchive.Service.FileService/Properties/launchSettings.json new file mode 100644 index 0000000..60a6c18 --- /dev/null +++ b/FictionArchive.Service.FileService/Properties/launchSettings.json @@ -0,0 +1,39 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:5546", + "sslPort": 44373 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5057", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7247;http://localhost:5057", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/FictionArchive.Service.FileService/Services/EventHandlers/FileUploadRequestCreatedEventHandler.cs b/FictionArchive.Service.FileService/Services/EventHandlers/FileUploadRequestCreatedEventHandler.cs new file mode 100644 index 0000000..b79d65c --- /dev/null +++ b/FictionArchive.Service.FileService/Services/EventHandlers/FileUploadRequestCreatedEventHandler.cs @@ -0,0 +1,57 @@ +using Amazon.S3; +using Amazon.S3.Model; +using FictionArchive.Common.Enums; +using FictionArchive.Service.FileService.Models; +using FictionArchive.Service.FileService.Models.IntegrationEvents; +using FictionArchive.Service.Shared.Services.EventBus; +using Microsoft.Extensions.Options; + +namespace FictionArchive.Service.FileService.Services.EventHandlers; + +public class FileUploadRequestCreatedEventHandler : IIntegrationEventHandler +{ + private readonly ILogger _logger; + private readonly AmazonS3Client _amazonS3Client; + private readonly IEventBus _eventBus; + private readonly S3Configuration _s3Configuration; + private readonly ProxyConfiguration _proxyConfiguration; + + public FileUploadRequestCreatedEventHandler(ILogger logger, AmazonS3Client amazonS3Client, IEventBus eventBus, IOptions s3Configuration, IOptions proxyConfiguration) + { + _logger = logger; + _amazonS3Client = amazonS3Client; + _eventBus = eventBus; + _proxyConfiguration = proxyConfiguration.Value; + _s3Configuration = s3Configuration.Value; + } + + public async Task Handle(FileUploadRequestCreatedEvent @event) + { + var putObjectRequest = new PutObjectRequest(); + putObjectRequest.BucketName = _s3Configuration.Bucket; + putObjectRequest.Key = @event.FilePath; + + using MemoryStream memoryStream = new MemoryStream(@event.FileData); + putObjectRequest.InputStream = memoryStream; + + var s3Response = await _amazonS3Client.PutObjectAsync(putObjectRequest); + if (s3Response.HttpStatusCode != System.Net.HttpStatusCode.OK) + { + _logger.LogError("An error occurred while uploading file to S3. Response code: {responsecode}", s3Response.HttpStatusCode); + await _eventBus.Publish(new FileUploadRequestStatusUpdateEvent() + { + RequestId = @event.RequestId, + Status = RequestStatus.Failed, + ErrorMessage = "An error occurred while uploading file to S3." + }); + return; + } + + await _eventBus.Publish(new FileUploadRequestStatusUpdateEvent() + { + Status = RequestStatus.Success, + RequestId = @event.RequestId, + FileAccessUrl = _proxyConfiguration.BaseUrl + "/" + @event.FilePath + }); + } +} \ No newline at end of file diff --git a/FictionArchive.Service.FileService/appsettings.Development.json b/FictionArchive.Service.FileService/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/FictionArchive.Service.FileService/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/FictionArchive.Service.FileService/appsettings.json b/FictionArchive.Service.FileService/appsettings.json new file mode 100644 index 0000000..9ebfc9c --- /dev/null +++ b/FictionArchive.Service.FileService/appsettings.json @@ -0,0 +1,22 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "Proxy": { + "BaseUrl": "https://localhost:7247/api" + }, + "RabbitMQ": { + "ConnectionString": "amqp://localhost", + "ClientIdentifier": "NovelService" + }, + "S3": { + "Url": "https://s3.orfl.xyz", + "Bucket": "fictionarchive", + "AccessKey": "REPLACE_ME", + "SecretKey": "REPLACE_ME" + }, + "AllowedHosts": "*" +} diff --git a/FictionArchive.Service.NovelService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs b/FictionArchive.Service.NovelService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs new file mode 100644 index 0000000..44e3f46 --- /dev/null +++ b/FictionArchive.Service.NovelService/Models/IntegrationEvents/FileUploadRequestCreatedEvent.cs @@ -0,0 +1,10 @@ +using FictionArchive.Service.Shared.Services.EventBus; + +namespace FictionArchive.Service.FileService.IntegrationEvents; + +public class FileUploadRequestCreatedEvent : IIntegrationEvent +{ + public Guid RequestId { get; set; } + public string FilePath { get; set; } + public byte[] FileData { get; set; } +} \ No newline at end of file diff --git a/FictionArchive.sln b/FictionArchive.sln index cee3dc2..6a6227c 100644 --- a/FictionArchive.sln +++ b/FictionArchive.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FictionArchive.Service.User EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FictionArchive.Service.AuthenticationService", "FictionArchive.Service.AuthenticationService\FictionArchive.Service.AuthenticationService.csproj", "{70C4AE82-B01E-421D-B590-C0F47E63CD0C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FictionArchive.Service.FileService", "FictionArchive.Service.FileService\FictionArchive.Service.FileService.csproj", "{EC64A336-F8A0-4BED-9CA3-1B05AD00631D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -54,5 +56,9 @@ Global {70C4AE82-B01E-421D-B590-C0F47E63CD0C}.Debug|Any CPU.Build.0 = Debug|Any CPU {70C4AE82-B01E-421D-B590-C0F47E63CD0C}.Release|Any CPU.ActiveCfg = Release|Any CPU {70C4AE82-B01E-421D-B590-C0F47E63CD0C}.Release|Any CPU.Build.0 = Release|Any CPU + {EC64A336-F8A0-4BED-9CA3-1B05AD00631D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC64A336-F8A0-4BED-9CA3-1B05AD00631D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC64A336-F8A0-4BED-9CA3-1B05AD00631D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC64A336-F8A0-4BED-9CA3-1B05AD00631D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal