[FA-5] Adds image support with proper S3 upload and replacement after upload

This commit is contained in:
gamer147
2025-11-23 21:16:26 -05:00
parent 573a0f6e3f
commit 16ed16ff62
33 changed files with 1321 additions and 267 deletions

View File

@@ -0,0 +1,6 @@
namespace FictionArchive.Service.NovelService.Models.Configuration;
public class NovelUpdateServiceConfiguration
{
public string PendingImageUrl { get; set; }
}

View File

@@ -0,0 +1,13 @@
using FictionArchive.Service.NovelService.Models.Novels;
using FictionArchive.Service.Shared.Models;
namespace FictionArchive.Service.NovelService.Models.Images;
public class Image : BaseEntity<Guid>
{
public string OriginalPath { get; set; }
public string? NewPath { get; set; }
// Chapter link. Even if an image appears in another chapter, we should rehost it separately.
public Chapter? Chapter { get; set; }
}

View File

@@ -0,0 +1,22 @@
using FictionArchive.Common.Enums;
using FictionArchive.Service.Shared.Services.EventBus;
namespace FictionArchive.Service.NovelService.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
}

View File

@@ -1,3 +1,4 @@
using FictionArchive.Service.NovelService.Models.Images;
using FictionArchive.Service.NovelService.Models.Localization;
using FictionArchive.Service.Shared.Models;
@@ -11,4 +12,7 @@ public class Chapter : BaseEntity<uint>
public LocalizationKey Name { get; set; }
public LocalizationKey Body { get; set; }
// Images appearing in this chapter.
public List<Image> Images { get; set; }
}

View File

@@ -1,4 +1,5 @@
using FictionArchive.Common.Enums;
using FictionArchive.Service.NovelService.Models.Images;
using FictionArchive.Service.NovelService.Models.Localization;
using FictionArchive.Service.Shared.Models;
using NovelStatus = FictionArchive.Service.NovelService.Models.Enums.NovelStatus;
@@ -22,4 +23,5 @@ public class Novel : BaseEntity<uint>
public List<Chapter> Chapters { get; set; }
public List<NovelTag> Tags { get; set; }
public Image? CoverImage { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
public class ChapterFetchResult
{
public string Text { get; set; }
public List<ImageData> ImageData { get; set; }
}

View File

@@ -6,5 +6,5 @@ public class ChapterMetadata
public uint Order { get; set; }
public string? Url { get; set; }
public string Name { get; set; }
public List<string> ImageUrls { get; set; }
}

View File

@@ -0,0 +1,7 @@
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
public class ImageData
{
public string Url { get; set; }
public byte[] Data { get; set; }
}

View File

@@ -11,6 +11,7 @@ public class NovelMetadata
public string AuthorUrl { get; set; }
public string Url { get; set; }
public string ExternalId { get; set; }
public ImageData? CoverImage { get; set; }
public Language RawLanguage { get; set; }
public NovelStatus RawStatus { get; set; }