diff options
| author | transtrike <transtrike@gmail.com> | 2020-12-17 19:37:38 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2020-12-17 19:37:38 +0200 |
| commit | 33a1a5899a16378691cd62d9ee4644db2a02e2b7 (patch) | |
| tree | 20410322225b99a6a44576cfdfb6729423d0855f /src/DevHive.Web | |
| parent | 94a3b0661106e91ab3a1a523af3c60df131a4f63 (diff) | |
| download | DevHive-33a1a5899a16378691cd62d9ee4644db2a02e2b7.tar DevHive-33a1a5899a16378691cd62d9ee4644db2a02e2b7.tar.gz DevHive-33a1a5899a16378691cd62d9ee4644db2a02e2b7.zip | |
RoleModel moved to DevHive.Common
Diffstat (limited to 'src/DevHive.Web')
4 files changed, 12 insertions, 12 deletions
diff --git a/src/DevHive.Web/Configurations/Extensions/ConfigureAutoMapper.cs b/src/DevHive.Web/Configurations/Extensions/ConfigureAutoMapper.cs index afba39c..b6ebc63 100644 --- a/src/DevHive.Web/Configurations/Extensions/ConfigureAutoMapper.cs +++ b/src/DevHive.Web/Configurations/Extensions/ConfigureAutoMapper.cs @@ -1,6 +1,7 @@ using System; using AutoMapper; using AutoMapper.Configuration; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; namespace DevHive.Web.Configurations.Extensions @@ -11,5 +12,13 @@ namespace DevHive.Web.Configurations.Extensions { services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); } + + public static void UseAutoMapperConfiguration(this IApplicationBuilder app) + { + var config = new MapperConfiguration(cfg => + { + cfg.AllowNullCollections = true; + }); + } } }
\ No newline at end of file diff --git a/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs b/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs deleted file mode 100644 index d8ae465..0000000 --- a/src/DevHive.Web/Models/Identity/Role/RoleWebModel.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace DevHive.Web.Models.Identity.Role -{ - public class RoleWebModel - { - public Guid Id { get; set; } - public string Name { get; set; } - } -} diff --git a/src/DevHive.Web/Models/Identity/User/UserWebModel.cs b/src/DevHive.Web/Models/Identity/User/UserWebModel.cs index e7bdb2a..83430ce 100644 --- a/src/DevHive.Web/Models/Identity/User/UserWebModel.cs +++ b/src/DevHive.Web/Models/Identity/User/UserWebModel.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; +using DevHive.Common.Models.Identity; using DevHive.Web.Models.Identity.Role; namespace DevHive.Web.Models.Identity.User { public class UserWebModel : BaseUserWebModel { - public IList<RoleWebModel> Role { get; set; } = new List<RoleWebModel>(); + public IList<RoleModel> Role { get; set; } = new List<RoleModel>(); public IList<UserWebModel> Friends { get; set; } = new List<UserWebModel>(); } } diff --git a/src/DevHive.Web/Startup.cs b/src/DevHive.Web/Startup.cs index fac1b4a..66fde9e 100644 --- a/src/DevHive.Web/Startup.cs +++ b/src/DevHive.Web/Startup.cs @@ -50,8 +50,8 @@ namespace DevHive.Web }
app.UseDatabaseConfiguration();
+ app.UseAutoMapperConfiguration();
-
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
|
