From 8282f6c3f89ee65be155d453ddd705892b07628e Mon Sep 17 00:00:00 2001 From: transtrike Date: Sun, 28 Mar 2021 19:21:49 +0300 Subject: ProfilePic saved in User fixed --- src/Data/DevHive.Data/DevHiveContext.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Data/DevHive.Data/DevHiveContext.cs') diff --git a/src/Data/DevHive.Data/DevHiveContext.cs b/src/Data/DevHive.Data/DevHiveContext.cs index f8574a4..0606864 100644 --- a/src/Data/DevHive.Data/DevHiveContext.cs +++ b/src/Data/DevHive.Data/DevHiveContext.cs @@ -26,9 +26,6 @@ namespace DevHive.Data .HasIndex(x => x.UserName) .IsUnique(); - builder.Entity() - .HasOne(x => x.ProfilePicture); - /* Roles */ builder.Entity() .HasMany(x => x.Roles) @@ -91,6 +88,15 @@ namespace DevHive.Data .HasMany(x => x.Ratings) .WithOne(x => x.Post); + /* Profile Picture */ + builder.Entity() + .HasKey(x => x.Id); + + builder.Entity() + .HasOne(x => x.ProfilePicture) + .WithOne(x => x.User) + .HasForeignKey(x => x.UserId); + base.OnModelCreating(builder); } } -- cgit v1.2.3