[FA-misc] Switches to using DTOs, updates frontend with details and reader page, updates novel import to be an upsert
This commit is contained in:
10
FictionArchive.Service.NovelService/Models/DTOs/BaseDto.cs
Normal file
10
FictionArchive.Service.NovelService/Models/DTOs/BaseDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using NodaTime;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public abstract class BaseDto<TKey>
|
||||
{
|
||||
public TKey Id { get; init; }
|
||||
public Instant CreatedTime { get; init; }
|
||||
public Instant LastUpdatedTime { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class ChapterDto : BaseDto<uint>
|
||||
{
|
||||
public uint Revision { get; init; }
|
||||
public uint Order { get; init; }
|
||||
public string? Url { get; init; }
|
||||
public required string Name { get; init; }
|
||||
public required string Body { get; init; }
|
||||
public required List<ImageDto> Images { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class ChapterReaderDto : BaseDto<uint>
|
||||
{
|
||||
public uint Revision { get; init; }
|
||||
public uint Order { get; init; }
|
||||
public string? Url { get; init; }
|
||||
public required string Name { get; init; }
|
||||
public required string Body { get; init; }
|
||||
public required List<ImageDto> Images { get; init; }
|
||||
|
||||
// Navigation context
|
||||
public uint NovelId { get; init; }
|
||||
public required string NovelName { get; init; }
|
||||
public int TotalChapters { get; init; }
|
||||
public uint? PrevChapterOrder { get; init; }
|
||||
public uint? NextChapterOrder { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class ImageDto : BaseDto<Guid>
|
||||
{
|
||||
public string? NewPath { get; init; }
|
||||
}
|
||||
20
FictionArchive.Service.NovelService/Models/DTOs/NovelDto.cs
Normal file
20
FictionArchive.Service.NovelService/Models/DTOs/NovelDto.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Enums;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class NovelDto : BaseDto<uint>
|
||||
{
|
||||
public required PersonDto Author { get; init; }
|
||||
public required string Url { get; init; }
|
||||
public Language RawLanguage { get; init; }
|
||||
public NovelStatus RawStatus { get; init; }
|
||||
public NovelStatus? StatusOverride { get; init; }
|
||||
public required SourceDto Source { get; init; }
|
||||
public required string ExternalId { get; init; }
|
||||
public required string Name { get; init; }
|
||||
public required string Description { get; init; }
|
||||
public required List<ChapterDto> Chapters { get; init; }
|
||||
public required List<NovelTagDto> Tags { get; init; }
|
||||
public ImageDto? CoverImage { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FictionArchive.Service.NovelService.Models.Enums;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class NovelTagDto : BaseDto<uint>
|
||||
{
|
||||
public required string Key { get; init; }
|
||||
public required string DisplayName { get; init; }
|
||||
public TagType TagType { get; init; }
|
||||
public SourceDto? Source { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class PersonDto : BaseDto<uint>
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
public string? ExternalUrl { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.DTOs;
|
||||
|
||||
public class SourceDto : BaseDto<uint>
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
public required string Key { get; init; }
|
||||
public required string Url { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user