Initial commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Enums;
|
||||
|
||||
public enum NovelStatus
|
||||
{
|
||||
Unknown,
|
||||
InProgress,
|
||||
Completed,
|
||||
Hiatus,
|
||||
Abandoned
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Enums;
|
||||
|
||||
public enum TagType
|
||||
{
|
||||
System,
|
||||
External,
|
||||
UserDefined,
|
||||
Genre,
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Novels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.Localization;
|
||||
|
||||
public class LocalizationKey : BaseEntity<uint>
|
||||
{
|
||||
public List<LocalizationText> Texts { get; set; }
|
||||
|
||||
public static LocalizationKey CreateFromText(string text, Language language)
|
||||
{
|
||||
return new LocalizationKey()
|
||||
{
|
||||
Texts = new List<LocalizationText>()
|
||||
{
|
||||
new LocalizationText()
|
||||
{
|
||||
Language = language,
|
||||
Text = text
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.Localization;
|
||||
|
||||
public class LocalizationText : BaseEntity<uint>
|
||||
{
|
||||
public Language Language { get; set; }
|
||||
public string Text { get; set; }
|
||||
public TranslationEngine? TranslationEngine { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public abstract class BaseEntity<TKey>
|
||||
{
|
||||
public uint Id { get; set; }
|
||||
public DateTime CreatedUtc { get; set; }
|
||||
public DateTime UpdatedUtc { get; set; }
|
||||
}
|
||||
13
FictionArchive.Service.NovelService/Models/Novels/Chapter.cs
Normal file
13
FictionArchive.Service.NovelService/Models/Novels/Chapter.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using FictionArchive.Service.NovelService.Models.Localization;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class Chapter : BaseEntity<uint>
|
||||
{
|
||||
public uint Revision { get; set; }
|
||||
public uint Order { get; set; }
|
||||
public string? Url { get; set; }
|
||||
|
||||
public LocalizationKey Name { get; set; }
|
||||
public LocalizationKey Body { get; set; }
|
||||
}
|
||||
24
FictionArchive.Service.NovelService/Models/Novels/Novel.cs
Normal file
24
FictionArchive.Service.NovelService/Models/Novels/Novel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Localization;
|
||||
using NovelStatus = FictionArchive.Service.NovelService.Models.Enums.NovelStatus;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class Novel : BaseEntity<uint>
|
||||
{
|
||||
public Person Author { get; set; }
|
||||
public string Url { get; set; }
|
||||
public Language RawLanguage { get; set; }
|
||||
|
||||
public NovelStatus RawStatus { get; set; }
|
||||
public NovelStatus? StatusOverride { get; set; }
|
||||
|
||||
public Source Source { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
public LocalizationKey Name { get; set; }
|
||||
public LocalizationKey Description { get; set; }
|
||||
|
||||
public List<Chapter> Chapters { get; set; }
|
||||
public List<NovelTag> Tags { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using FictionArchive.Service.NovelService.Models.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Localization;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class NovelTag : BaseEntity<uint>
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public LocalizationKey DisplayName { get; set; }
|
||||
public TagType TagType { get; set; }
|
||||
|
||||
public Source? Source { get; set; }
|
||||
public List<Novel> Novels { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class Person : BaseEntity<uint>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string? ExternalUrl { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class Source : BaseEntity<uint>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models;
|
||||
|
||||
public class SourceConfiguration : BaseEntity<uint>
|
||||
{
|
||||
public string Key { get; set; }
|
||||
|
||||
[Column(TypeName = "jsonb")]
|
||||
public string Configuration { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.Novels;
|
||||
|
||||
public class TranslationEngine : BaseEntity<uint>
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
|
||||
|
||||
public class ChapterMetadata
|
||||
{
|
||||
public uint Revision { get; set; }
|
||||
public uint Order { get; set; }
|
||||
public string? Url { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using FictionArchive.Common.Enums;
|
||||
using FictionArchive.Service.NovelService.Models.Enums;
|
||||
|
||||
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
|
||||
|
||||
public class NovelMetadata
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string AuthorName { get; set; }
|
||||
public string AuthorUrl { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string ExternalId { get; set; }
|
||||
|
||||
public Language RawLanguage { get; set; }
|
||||
public NovelStatus RawStatus { get; set; }
|
||||
|
||||
public List<ChapterMetadata> Chapters { get; set; }
|
||||
public List<string> SourceTags { get; set; }
|
||||
public List<string> SystemTags { get; set; }
|
||||
public SourceDescriptor SourceDescriptor { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace FictionArchive.Service.NovelService.Models.SourceAdapters;
|
||||
|
||||
public class SourceDescriptor
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user