From 60ed435203f0c60d4c6fabe77aa4e87656aaf8c1 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Fri, 5 Feb 2021 16:36:47 +0200 Subject: Adding some metods to Rate repo --- .../Migrations/DevHiveContextModelSnapshot.cs | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs') diff --git a/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs b/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs index 0450670..d675914 100644 --- a/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs +++ b/src/DevHive.Data/Migrations/DevHiveContextModelSnapshot.cs @@ -112,11 +112,17 @@ namespace DevHive.Data.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("PostId") + .HasColumnType("uuid"); + b.Property("Rate") .HasColumnType("integer"); b.HasKey("Id"); + b.HasIndex("PostId") + .IsUnique(); + b.ToTable("Rating"); }); @@ -271,14 +277,19 @@ namespace DevHive.Data.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.Property("Rate") + b.Property("Liked") .HasColumnType("boolean"); + b.Property("PostId") + .HasColumnType("uuid"); + b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); + b.HasIndex("PostId"); + b.HasIndex("UserId"); b.ToTable("UserRates"); @@ -465,6 +476,17 @@ namespace DevHive.Data.Migrations b.Navigation("User"); }); + modelBuilder.Entity("DevHive.Data.Models.Rating", b => + { + b.HasOne("DevHive.Data.Models.Post", "Post") + .WithOne("Rating") + .HasForeignKey("DevHive.Data.Models.Rating", "PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Post"); + }); + modelBuilder.Entity("DevHive.Data.RelationModels.RatedPost", b => { b.HasOne("DevHive.Data.Models.Post", "Post") @@ -474,7 +496,7 @@ namespace DevHive.Data.Migrations .IsRequired(); b.HasOne("DevHive.Data.Models.User", "User") - .WithMany() + .WithMany("RatedPosts") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -505,10 +527,16 @@ namespace DevHive.Data.Migrations modelBuilder.Entity("DevHive.Data.RelationModels.UserRate", b => { + b.HasOne("DevHive.Data.Models.Post", "Post") + .WithMany() + .HasForeignKey("PostId"); + b.HasOne("DevHive.Data.Models.User", "User") .WithMany() .HasForeignKey("UserId"); + b.Navigation("Post"); + b.Navigation("User"); }); @@ -611,6 +639,8 @@ namespace DevHive.Data.Migrations modelBuilder.Entity("DevHive.Data.Models.Post", b => { b.Navigation("Comments"); + + b.Navigation("Rating"); }); modelBuilder.Entity("DevHive.Data.Models.User", b => @@ -624,6 +654,8 @@ namespace DevHive.Data.Migrations b.Navigation("Posts"); b.Navigation("ProfilePicture"); + + b.Navigation("RatedPosts"); }); #pragma warning restore 612, 618 } -- cgit v1.2.3