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 --- src/DevHive.Data/DevHiveContext.cs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/DevHive.Data/DevHiveContext.cs') diff --git a/src/DevHive.Data/DevHiveContext.cs b/src/DevHive.Data/DevHiveContext.cs index b3ebd73..0cc28bb 100644 --- a/src/DevHive.Data/DevHiveContext.cs +++ b/src/DevHive.Data/DevHiveContext.cs @@ -95,31 +95,28 @@ namespace DevHive.Data builder.Entity() .HasKey(x => x.Id); - // builder.Entity() - // .HasOne(x => x.Post) - // .WithOne(x => x.Rating) - // .HasForeignKey(x => x.RatingId); - - // builder.Entity() - // .HasOne(x => x.Rating) - // .WithOne(x => x.Post); + builder.Entity() + .HasOne(x => x.Post) + .WithOne(x => x.Rating) + .HasForeignKey(x => x.PostId); - // builder.Entity() - // .HasMany(x => x.UsersThatRated); + builder.Entity() + .HasOne(x => x.Rating) + .WithOne(x => x.Post); - // /* User Rated Posts */ + /* User Rated Posts */ builder.Entity() .HasKey(x => new { x.UserId, x.PostId }); - // builder.Entity() - // .HasOne(x => x.User) - // .WithMany(x => x.RatedPosts); + builder.Entity() + .HasOne(x => x.User) + .WithMany(x => x.RatedPosts); - // builder.Entity() - // .HasOne(x => x.Post); + builder.Entity() + .HasOne(x => x.Post); - // builder.Entity() - // .HasMany(x => x.RatedPosts); + builder.Entity() + .HasMany(x => x.RatedPosts); base.OnModelCreating(builder); } -- cgit v1.2.3