diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-26 18:50:15 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-26 18:50:15 +0200 |
| commit | c73d806b0a16be208402c5922eb3242c469e86b3 (patch) | |
| tree | 279b667ffe21de10e0e5d21f31a3696b2f83560c /src | |
| parent | b5316d00cbaee97a2c4a74005de87cd1bc26ec28 (diff) | |
| download | DevHive-c73d806b0a16be208402c5922eb3242c469e86b3.tar DevHive-c73d806b0a16be208402c5922eb3242c469e86b3.tar.gz DevHive-c73d806b0a16be208402c5922eb3242c469e86b3.zip | |
DbContext configurations
Diffstat (limited to 'src')
| -rw-r--r-- | src/DevHive.Data/DevHiveContext.cs | 9 | ||||
| -rw-r--r-- | src/DevHive.Data/Repositories/UserRepository.cs | 12 | ||||
| -rw-r--r-- | src/DevHive.Services/Services/UserService.cs | 1 | ||||
| -rw-r--r-- | src/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs | 4 |
4 files changed, 10 insertions, 16 deletions
diff --git a/src/DevHive.Data/DevHiveContext.cs b/src/DevHive.Data/DevHiveContext.cs index c1bda49..17e16e7 100644 --- a/src/DevHive.Data/DevHiveContext.cs +++ b/src/DevHive.Data/DevHiveContext.cs @@ -27,6 +27,15 @@ namespace DevHive.Data builder.Entity<User>() .HasMany(x => x.Friends); + builder.Entity<User>() + .HasMany(x => x.Languages); + + builder.Entity<User>() + .HasMany(x => x.Technologies); + + builder.Entity<User>() + .HasChangeTrackingStrategy(ChangeTrackingStrategy.Snapshot); + base.OnModelCreating(builder); } } diff --git a/src/DevHive.Data/Repositories/UserRepository.cs b/src/DevHive.Data/Repositories/UserRepository.cs index 6d4a175..06bafca 100644 --- a/src/DevHive.Data/Repositories/UserRepository.cs +++ b/src/DevHive.Data/Repositories/UserRepository.cs @@ -49,18 +49,6 @@ namespace DevHive.Data.Repositories } #endregion - #region Update - public override async Task<bool> EditAsync(Guid id, User newEntity) - { - User user = await GetByIdAsync(id); - - this._context.Update(user); - user = newEntity; - - return await this.SaveChangesAsync(this._context); - } - #endregion - #region Validations public async Task<bool> DoesUserExistAsync(Guid id) { diff --git a/src/DevHive.Services/Services/UserService.cs b/src/DevHive.Services/Services/UserService.cs index 0e3bf72..abbecb1 100644 --- a/src/DevHive.Services/Services/UserService.cs +++ b/src/DevHive.Services/Services/UserService.cs @@ -71,6 +71,7 @@ namespace DevHive.Services.Services user.PasswordHash = PasswordModifications.GeneratePasswordHash(registerModel.Password); // Make sure the default role exists + //TODO: Move when project starts if (!await this._roleRepository.DoesNameExist(Role.DefaultRole)) await this._roleRepository.AddAsync(new Role { Name = Role.DefaultRole }); diff --git a/src/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs b/src/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs index 6e92a65..1a80984 100644 --- a/src/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs +++ b/src/DevHive.Web/Configurations/Extensions/ConfigureDatabase.cs @@ -38,8 +38,6 @@ namespace DevHive.Web.Configurations.Extensions options.Lockout.AllowedForNewUsers = true; options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5); options.Lockout.MaxFailedAccessAttempts = 5; - - options.Stores.MaxLengthForKeys = 20; }); services.AddAuthorization(options => @@ -57,8 +55,6 @@ namespace DevHive.Web.Configurations.Extensions options.AuthenticationSchemes.Add(JwtBearerDefaults.AuthenticationScheme); options.RequireRole("Admin"); }); - - // options.DefaultPolicy = ; }); } |
