[FA-5] Adds image support with proper S3 upload and replacement after upload
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Configuration;
|
||||
|
||||
public class NovelUpdateServiceConfiguration
|
||||
{
|
||||
public string PendingImageUrl { get; set; }
|
||||
}
|
||||
13
FictionArchive.Service.NovelService/Models/Images/Image.cs
Normal file
13
FictionArchive.Service.NovelService/Models/Images/Image.cs
Normal 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; }
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
|
||||
|
||||
public class ChapterFetchResult
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public List<ImageData> ImageData { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
|
||||
|
||||
public class ImageData
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user