diff options
| author | Victor S <57849063+transtrike@users.noreply.github.com> | 2021-04-02 23:55:25 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-02 23:55:25 +0300 |
| commit | bad7456b379bcc683431e2279591f7c5227bd55a (patch) | |
| tree | b82e15d10e28759dcd066b38ccdd16c23753b33c /src/Data/DevHive.Data/DevHiveContext.cs | |
| parent | 2448c4d31188aed26605c5e3c282bacc3bd71ae5 (diff) | |
| parent | b0c6c6e1795a1cc8fe82a60ce16a263ab4cad397 (diff) | |
| download | DevHive-bad7456b379bcc683431e2279591f7c5227bd55a.tar DevHive-bad7456b379bcc683431e2279591f7c5227bd55a.tar.gz DevHive-bad7456b379bcc683431e2279591f7c5227bd55a.zip | |
Merge pull request #24 from Team-Kaleidoscope/feature/profile_picture_implementation
- Removed InsertProfilePicture from Service layer (unneeded)
- ReadProfilePicture endpoint implemented
Diffstat (limited to 'src/Data/DevHive.Data/DevHiveContext.cs')
| -rw-r--r-- | src/Data/DevHive.Data/DevHiveContext.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Data/DevHive.Data/DevHiveContext.cs b/src/Data/DevHive.Data/DevHiveContext.cs index 621336f..0606864 100644 --- a/src/Data/DevHive.Data/DevHiveContext.cs +++ b/src/Data/DevHive.Data/DevHiveContext.cs @@ -17,6 +17,7 @@ namespace DevHive.Data public DbSet<PostAttachments> PostAttachments { get; set; } public DbSet<Comment> Comments { get; set; } public DbSet<Rating> Rating { get; set; } + public DbSet<ProfilePicture> ProfilePicture { get; set; } protected override void OnModelCreating(ModelBuilder builder) { @@ -25,11 +26,6 @@ namespace DevHive.Data .HasIndex(x => x.UserName) .IsUnique(); - builder.Entity<User>() - .HasOne(x => x.ProfilePicture) - .WithOne(x => x.User) - .HasForeignKey<ProfilePicture>(x => x.UserId); - /* Roles */ builder.Entity<User>() .HasMany(x => x.Roles) @@ -92,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); } } |
