Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 3182043

Browse files
committed
poc
1 parent e9e1584 commit 3182043

180 files changed

Lines changed: 174 additions & 7719 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Backend/Jp.Application/AutoMapper/DomainToViewModelMappingProfile.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
using Jp.Application.ViewModels.ApiResouceViewModels;
66
using Jp.Application.ViewModels.ClientsViewModels;
77
using Jp.Application.ViewModels.IdentityResourceViewModels;
8-
using Jp.Application.ViewModels.RoleViewModels;
9-
using Jp.Application.ViewModels.UserViewModels;
108
using Jp.Domain.Core.Events;
11-
using Jp.Domain.Models;
129
using System.Globalization;
1310
using System.Security.Claims;
1411

@@ -19,8 +16,6 @@ public class DomainToViewModelMappingProfile : Profile
1916
public DomainToViewModelMappingProfile()
2017
{
2118
CreateMap<IdentityServer4.EntityFramework.Entities.ApiResource, ApiResourceListViewModel>();
22-
CreateMap<User, UserViewModel>(MemberList.Destination);//.ForMember(x => x.LockoutEnd, opt => opt.MapFrom(src => src.LockoutEnd != null ? src.LockoutEnd.Value.DateTime.ToShortDateString() : string.Empty));
23-
CreateMap<User, UserListViewModel>(MemberList.Destination);
2419

2520
CreateMap<StoredEvent, EventHistoryData>().ConstructUsing(a => new EventHistoryData(a.Message, a.Id.ToString(), a.Details, a.Timestamp.ToString(CultureInfo.InvariantCulture), a.User, a.MessageType, a.RemoteIpAddress));
2621
CreateMap<Client, ClientListViewModel>(MemberList.Destination);
@@ -32,8 +27,6 @@ public DomainToViewModelMappingProfile()
3227
CreateMap<IdentityServer4.EntityFramework.Entities.UserClaim, ClaimViewModel>(MemberList.Destination);
3328

3429
CreateMap<Claim, ClaimViewModel>(MemberList.Destination);
35-
CreateMap<Role, RoleViewModel>(MemberList.Destination);
36-
CreateMap<UserLogin, UserLoginViewModel>(MemberList.Destination);
3730

3831
}
3932
}

src/Backend/Jp.Application/AutoMapper/ViewModelToDomainMappingProfile.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@
44
using Jp.Application.ViewModels.ApiResouceViewModels;
55
using Jp.Application.ViewModels.ClientsViewModels;
66
using Jp.Application.ViewModels.IdentityResourceViewModels;
7-
using Jp.Application.ViewModels.RoleViewModels;
8-
using Jp.Application.ViewModels.UserViewModels;
97
using Jp.Domain.Commands.ApiResource;
108
using Jp.Domain.Commands.Clients;
119
using Jp.Domain.Commands.IdentityResource;
1210
using Jp.Domain.Commands.PersistedGrant;
13-
using Jp.Domain.Commands.Role;
14-
using Jp.Domain.Commands.User;
15-
using Jp.Domain.Commands.UserManagement;
1611

1712
namespace Jp.Application.AutoMapper
1813
{
@@ -25,33 +20,6 @@ public ViewModelToDomainMappingProfile()
2520
*/
2621
CreateMap<RemovePersistedGrantViewModel, RemovePersistedGrantCommand>().ConstructUsing(c => new RemovePersistedGrantCommand(c.Key));
2722

28-
/*
29-
* User Creation Commands
30-
*/
31-
CreateMap<RegisterUserViewModel, RegisterNewUserCommand>().ConstructUsing(c => new RegisterNewUserCommand(c.Username, c.Email, c.Name, c.PhoneNumber, c.Password, c.ConfirmPassword));
32-
CreateMap<SocialViewModel, RegisterNewUserWithoutPassCommand>(MemberList.Source).ConstructUsing(c => new RegisterNewUserWithoutPassCommand(c.Email, c.Email, c.Name, c.Picture, c.Provider, c.ProviderId));
33-
CreateMap<RegisterUserViewModel, RegisterNewUserWithProviderCommand>().ConstructUsing(c => new RegisterNewUserWithProviderCommand(c.Username, c.Email, c.Name, c.PhoneNumber, c.Password, c.ConfirmPassword, c.Picture, c.Provider, c.ProviderId));
34-
CreateMap<ForgotPasswordViewModel, SendResetLinkCommand>().ConstructUsing(c => new SendResetLinkCommand(c.UsernameOrEmail, c.UsernameOrEmail));
35-
CreateMap<ResetPasswordViewModel, ResetPasswordCommand>().ConstructUsing(c => new ResetPasswordCommand(c.Password, c.ConfirmPassword, c.Code, c.Email));
36-
CreateMap<ConfirmEmailViewModel, ConfirmEmailCommand>().ConstructUsing(c => new ConfirmEmailCommand(c.Code, c.Email));
37-
CreateMap<SocialViewModel, AddLoginCommand>().ConstructUsing(c => new AddLoginCommand(c.Email, c.Provider, c.ProviderId));
38-
39-
/*
40-
* User Management commands
41-
*/
42-
CreateMap<UserViewModel, UpdateProfileCommand>().ConstructUsing(c => new UpdateProfileCommand(c.Id, c.Url, c.Bio, c.Company, c.JobTitle, c.Name, c.PhoneNumber));
43-
CreateMap<UserViewModel, UpdateUserCommand>().ConstructUsing(c => new UpdateUserCommand(c.Email, c.UserName, c.Name, c.PhoneNumber, c.EmailConfirmed, c.PhoneNumberConfirmed, c.TwoFactorEnabled, c.LockoutEnd, c.LockoutEnabled, c.AccessFailedCount));
44-
CreateMap<ProfilePictureViewModel, UpdateProfilePictureCommand>().ConstructUsing(c => new UpdateProfilePictureCommand(c.Id, c.Picture));
45-
CreateMap<ChangePasswordViewModel, ChangePasswordCommand>().ConstructUsing(c => new ChangePasswordCommand(c.Id, c.OldPassword, c.NewPassword, c.ConfirmPassword));
46-
CreateMap<SetPasswordViewModel, SetPasswordCommand>().ConstructUsing(c => new SetPasswordCommand(c.Id, c.NewPassword, c.ConfirmPassword));
47-
CreateMap<RemoveAccountViewModel, RemoveAccountCommand>().ConstructUsing(c => new RemoveAccountCommand(c.Id));
48-
CreateMap<SaveUserClaimViewModel, SaveUserClaimCommand>().ConstructUsing(c => new SaveUserClaimCommand(c.Username, c.Type, c.Value));
49-
CreateMap<RemoveUserClaimViewModel, RemoveUserClaimCommand>().ConstructUsing(c => new RemoveUserClaimCommand(c.Username, c.Type, c.Value));
50-
CreateMap<RemoveUserRoleViewModel, RemoveUserRoleCommand>().ConstructUsing(c => new RemoveUserRoleCommand(c.Username, c.Role));
51-
CreateMap<SaveUserRoleViewModel, SaveUserRoleCommand>().ConstructUsing(c => new SaveUserRoleCommand(c.Username, c.Role));
52-
CreateMap<RemoveUserLoginViewModel, RemoveUserLoginCommand>().ConstructUsing(c => new RemoveUserLoginCommand(c.Username, c.LoginProvider, c.ProviderKey));
53-
CreateMap<AdminChangePasswordViewodel, AdminChangePasswordCommand>().ConstructUsing(c => new AdminChangePasswordCommand(c.Password, c.ConfirmPassword, c.Username));
54-
5523
/*
5624
* Client commands
5725
*/
@@ -85,13 +53,6 @@ public ViewModelToDomainMappingProfile()
8553
CreateMap<RemoveApiScopeViewModel, RemoveApiScopeCommand>().ConstructUsing(c => new RemoveApiScopeCommand(c.Id, c.ResourceName));
8654
CreateMap<SaveApiScopeViewModel, SaveApiScopeCommand>().ConstructUsing(c => new SaveApiScopeCommand(c.ResourceName, c.Name, c.Description, c.DisplayName, c.Emphasize, c.ShowInDiscoveryDocument, c.UserClaims));
8755

88-
/*
89-
* Role commands
90-
*/
91-
CreateMap<RemoveRoleViewModel, RemoveRoleCommand>().ConstructUsing(c => new RemoveRoleCommand(c.Name));
92-
CreateMap<SaveRoleViewModel, SaveRoleCommand>().ConstructUsing(c => new SaveRoleCommand(c.Name));
93-
CreateMap<RemoveUserFromRoleViewModel, RemoveUserFromRoleCommand>().ConstructUsing(c => new RemoveUserFromRoleCommand(c.Role, c.Username));
94-
9556
}
9657
}
9758
}

src/Backend/Jp.Application/Interfaces/IImageStorage.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Backend/Jp.Application/Interfaces/IRoleManagerAppService.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Backend/Jp.Application/Interfaces/IUserAppService.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Backend/Jp.Application/Interfaces/IUserManageAppService.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/Backend/Jp.Application/Services/PersistedGrantAppService.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,24 @@ namespace Jp.Application.Services
1515
public class PersistedGrantAppService : IPersistedGrantAppService
1616
{
1717
private IMapper _mapper;
18-
private IEventStoreRepository _eventStoreRepository;
1918
private readonly IPersistedGrantRepository _persistedGrantRepository;
20-
private readonly IUserService _userService;
2119
public IMediatorHandler Bus { get; set; }
2220

2321
public PersistedGrantAppService(IMapper mapper,
2422
IMediatorHandler bus,
25-
IEventStoreRepository eventStoreRepository,
26-
IPersistedGrantRepository persistedGrantRepository,
27-
IUserService userService)
23+
IPersistedGrantRepository persistedGrantRepository)
2824
{
2925
_mapper = mapper;
3026
Bus = bus;
31-
_eventStoreRepository = eventStoreRepository;
3227
_persistedGrantRepository = persistedGrantRepository;
33-
_userService = userService;
3428
}
3529

3630
public async Task<ListOfPersistedGrantViewModel> GetPersistedGrants(PagingViewModel paging)
3731
{
3832
var resultado = await _persistedGrantRepository.GetGrants(paging);
3933
var total = await _persistedGrantRepository.Count();
40-
var subjects = await _userService.GetByIdAsync(resultado.Select(s => s.SubjectId).ToArray());
4134

42-
var grants = resultado.Select(s => new PersistedGrantViewModel(s.Key, s.Type, s.SubjectId, s.ClientId, s.CreationTime, s.Expiration, s.Data, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Email, subjects.FirstOrDefault(f => f.Id.ToString().ToLower() == s.SubjectId.ToLower())?.Picture));
35+
var grants = resultado.Select(s => new PersistedGrantViewModel(s.Key, s.Type, s.SubjectId, s.ClientId, s.CreationTime, s.Expiration, s.Data));
4336
return new ListOfPersistedGrantViewModel(grants, total);
4437
}
4538

src/Backend/Jp.Application/Services/RoleManagerAppService.cs

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)