fix: db model fixes and quote mapping

This commit is contained in:
2025-07-15 16:38:37 +02:00
parent a355c668bd
commit e2eea51a08
9 changed files with 98 additions and 31 deletions

View File

@@ -69,7 +69,7 @@ namespace QuotifyBE.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("ImageId")
b.Property<int?>("ImageId")
.HasColumnType("integer");
b.Property<DateTime>("LastUpdatedAt")
@@ -84,6 +84,8 @@ namespace QuotifyBE.Migrations
b.HasKey("Id");
b.HasIndex("ImageId");
b.HasIndex("UserId");
b.ToTable("Quotes");
@@ -101,7 +103,7 @@ namespace QuotifyBE.Migrations
b.HasIndex("CategoryId");
b.ToTable("QuoteCategory");
b.ToTable("QuoteCategories");
});
modelBuilder.Entity("QuotifyBE.Entities.User", b =>
@@ -131,12 +133,18 @@ namespace QuotifyBE.Migrations
modelBuilder.Entity("QuotifyBE.Entities.Quote", b =>
{
b.HasOne("QuotifyBE.Entities.Image", "Image")
.WithMany()
.HasForeignKey("ImageId");
b.HasOne("QuotifyBE.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
b.Navigation("User");
});
@@ -149,7 +157,7 @@ namespace QuotifyBE.Migrations
.IsRequired();
b.HasOne("QuotifyBE.Entities.Quote", "Quote")
.WithMany()
.WithMany("QuoteCategories")
.HasForeignKey("QuoteId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -158,6 +166,11 @@ namespace QuotifyBE.Migrations
b.Navigation("Quote");
});
modelBuilder.Entity("QuotifyBE.Entities.Quote", b =>
{
b.Navigation("QuoteCategories");
});
#pragma warning restore 612, 618
}
}