diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-01 16:03:38 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-01 16:03:38 +0200 |
| commit | b41f887712ef8f2f0b602da3042261a78c5f492a (patch) | |
| tree | fb6437ea34896da7c7db3a292bbdb8ee7d14e889 /src/DevHive.Data/DevHiveContext.cs | |
| parent | aa342542789b22f24ce3ecbfcb7888d4ff12d30c (diff) | |
| download | DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.tar DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.tar.gz DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.zip | |
Commented out implementation of Rating; Bug fixes
Diffstat (limited to 'src/DevHive.Data/DevHiveContext.cs')
| -rw-r--r-- | src/DevHive.Data/DevHiveContext.cs | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/DevHive.Data/DevHiveContext.cs b/src/DevHive.Data/DevHiveContext.cs index e7c606f..993ddb6 100644 --- a/src/DevHive.Data/DevHiveContext.cs +++ b/src/DevHive.Data/DevHiveContext.cs @@ -17,6 +17,8 @@ namespace DevHive.Data public DbSet<Comment> Comments { get; set; } public DbSet<UserFriends> UserFriends { get; set; } public DbSet<Rating> Rating { get; set; } + public DbSet<RatedPost> RatedPost { get; set; } + public DbSet<UserRate> UserRate { get; set; } protected override void OnModelCreating(ModelBuilder builder) { @@ -73,10 +75,6 @@ namespace DevHive.Data .HasMany(x => x.Comments) .WithOne(x => x.Post); - builder.Entity<Post>() - .HasOne(x => x.Rating) - .WithOne(x => x.Post); - /* Comment */ builder.Entity<Comment>() .HasOne(x => x.Post) @@ -86,6 +84,36 @@ namespace DevHive.Data .HasOne(x => x.Creator) .WithMany(x => x.Comments); + /* Rating */ + builder.Entity<Rating>() + .HasKey(x => x.Id); + + // builder.Entity<Rating>() + // .HasOne(x => x.Post) + // .WithOne(x => x.Rating) + // .HasForeignKey<Post>(x => x.RatingId); + + // builder.Entity<Post>() + // .HasOne(x => x.Rating) + // .WithOne(x => x.Post); + + // builder.Entity<Rating>() + // .HasMany(x => x.UsersThatRated); + + // /* User Rated Posts */ + builder.Entity<RatedPost>() + .HasKey(x => new { x.UserId, x.PostId }); + + // builder.Entity<RatedPost>() + // .HasOne(x => x.User) + // .WithMany(x => x.RatedPosts); + + // builder.Entity<RatedPost>() + // .HasOne(x => x.Post); + + // builder.Entity<User>() + // .HasMany(x => x.RatedPosts); + base.OnModelCreating(builder); } } |
