From 729f0187125490befa63b8cf700284fe34f32534 Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 16 Dec 2024 21:52:35 +0100 Subject: [PATCH] Fix relation Manga -> Tags and Manga -> Authors with many-many --- API/Schema/Manga.cs | 2 -- API/Schema/PgsqlContext.cs | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/API/Schema/Manga.cs b/API/Schema/Manga.cs index c87b15c..d5afb4c 100644 --- a/API/Schema/Manga.cs +++ b/API/Schema/Manga.cs @@ -55,10 +55,8 @@ public class Manga( [ForeignKey("MangaConnectorId")] public MangaConnector MangaConnector { get; private set; } = mangaConnector; - [ForeignKey("AuthorIds")] public ICollection Authors { get; internal set; } = authors; - [ForeignKey("TagIds")] public ICollection Tags { get; private set; } = tags; [ForeignKey("LinkIds")] diff --git a/API/Schema/PgsqlContext.cs b/API/Schema/PgsqlContext.cs index 4b952e4..ca63169 100644 --- a/API/Schema/PgsqlContext.cs +++ b/API/Schema/PgsqlContext.cs @@ -57,12 +57,14 @@ public class PgsqlContext(DbContextOptions options) : DbContext(op .Navigation(m => m.MangaConnector) .AutoInclude(); modelBuilder.Entity() - .HasMany(m => m.Authors); + .HasMany(m => m.Authors) + .WithMany(); modelBuilder.Entity() .Navigation(m => m.Authors) .AutoInclude(); modelBuilder.Entity() - .HasMany(m => m.Tags); + .HasMany(m => m.Tags) + .WithMany(); modelBuilder.Entity() .Navigation(m => m.Tags) .AutoInclude();