aboutsummaryrefslogtreecommitdiff
path: root/src/Data/DevHive.Data/DevHiveContext.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-03-28 19:21:49 +0300
committertranstrike <transtrike@gmail.com>2021-03-28 19:21:49 +0300
commit8282f6c3f89ee65be155d453ddd705892b07628e (patch)
tree822ce9d4043e2560234b21da568f685272cf722a /src/Data/DevHive.Data/DevHiveContext.cs
parenta789a23c3c8ddde8188f2da40402a1803f838f89 (diff)
downloadDevHive-8282f6c3f89ee65be155d453ddd705892b07628e.tar
DevHive-8282f6c3f89ee65be155d453ddd705892b07628e.tar.gz
DevHive-8282f6c3f89ee65be155d453ddd705892b07628e.zip
ProfilePic saved in User fixed
Diffstat (limited to 'src/Data/DevHive.Data/DevHiveContext.cs')
-rw-r--r--src/Data/DevHive.Data/DevHiveContext.cs12
1 files changed, 9 insertions, 3 deletions
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<User>()
- .HasOne(x => x.ProfilePicture);
-
/* Roles */
builder.Entity<User>()
.HasMany(x => x.Roles)
@@ -91,6 +88,15 @@ namespace DevHive.Data
.HasMany(x => x.Ratings)
.WithOne(x => x.Post);
+ /* Profile Picture */
+ builder.Entity<ProfilePicture>()
+ .HasKey(x => x.Id);
+
+ builder.Entity<User>()
+ .HasOne(x => x.ProfilePicture)
+ .WithOne(x => x.User)
+ .HasForeignKey<ProfilePicture>(x => x.UserId);
+
base.OnModelCreating(builder);
}
}