More updates.
This commit is contained in:
@@ -7,7 +7,7 @@ public class Manga
|
||||
|
||||
public virtual ICollection<MangaCover> Covers { get; set; } = [];
|
||||
public virtual ICollection<MangaTitle> Titles { get; set; } = [];
|
||||
public virtual ICollection<MangaDescription> Descriptions { get; set; } = [];
|
||||
//public virtual ICollection<MangaDescription> Descriptions { get; set; } = [];
|
||||
public virtual ICollection<MangaSource> Sources { get; set; } = [];
|
||||
public virtual ICollection<MangaContributor> Contributors { get; set; } = [];
|
||||
public virtual ICollection<MangaGenre> Genres { get; set; } = [];
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
//ConfigureMangaChapter(modelBuilder);
|
||||
//ConfigureChapterSource(modelBuilder);
|
||||
//ConfigureChapterPage(modelBuilder);
|
||||
ConfigureSourceChapter(modelBuilder);
|
||||
ConfigureMangaSourceChapter(modelBuilder);
|
||||
ConfigureSourcePage(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -114,29 +114,29 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
{
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasKey(mangaTitle => mangaTitle.MangaTitleId);
|
||||
.HasKey(mangaDescription => mangaDescription.MangaDescriptionId);
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.Property(mt => mt.Name)
|
||||
.Property(mangaDescription => mangaDescription.Name)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.Property(mt => mt.Language)
|
||||
.Property(mangaDescription => mangaDescription.Language)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.HasIndex(mangaTitle => new { mangaTitle.MangaId, mangaTitle.Name, mangaTitle.Language })
|
||||
.HasIndex(mangaDescription => new { mangaDescription.MangaSourceId, mangaDescription.Name, mangaDescription.Language })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasIndex(mangaTitle => mangaTitle.Name);
|
||||
.HasIndex(mangaDescription => mangaDescription.Name);
|
||||
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasOne(x => x.Manga)
|
||||
.HasOne(x => x.MangaSource)
|
||||
.WithMany(x => x.Descriptions)
|
||||
.HasForeignKey(x => x.MangaId)
|
||||
.HasForeignKey(x => x.MangaSourceId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
// .OnDelete(DeleteBehavior.Cascade);
|
||||
//}
|
||||
|
||||
private static void ConfigureSourceChapter(ModelBuilder modelBuilder)
|
||||
private static void ConfigureMangaSourceChapter(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.Entity<SourceChapter>()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace MangaReader.Core.Data;
|
||||
using MangaReader.Core.Common;
|
||||
|
||||
namespace MangaReader.Core.Data;
|
||||
|
||||
public class MangaContributor
|
||||
{
|
||||
@@ -8,5 +10,5 @@ public class MangaContributor
|
||||
public int ContributorId { get; set; }
|
||||
public required Contributor Contributor { get; set; }
|
||||
|
||||
public MangaContributorRole Role { get; set; }
|
||||
public ContributorRole Role { get; set; }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace MangaReader.Core.Data;
|
||||
|
||||
public enum MangaContributorRole
|
||||
{
|
||||
Author,
|
||||
Artist
|
||||
}
|
||||
@@ -4,10 +4,10 @@ namespace MangaReader.Core.Data;
|
||||
|
||||
public class MangaDescription
|
||||
{
|
||||
public int MangaTitleId { get; set; }
|
||||
public int MangaDescriptionId { get; set; }
|
||||
|
||||
public int MangaId { get; set; }
|
||||
public required Manga Manga { get; set; }
|
||||
public int MangaSourceId { get; set; }
|
||||
public required MangaSource MangaSource { get; set; }
|
||||
|
||||
public required string Name { get; set; }
|
||||
public required Language Language { get; set; }
|
||||
|
||||
@@ -12,5 +12,6 @@ public class MangaSource
|
||||
|
||||
public required string Url { get; set; }
|
||||
|
||||
public virtual ICollection<MangaDescription> Descriptions { get; set; } = [];
|
||||
public virtual ICollection<SourceChapter> Chapters { get; set; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user