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

Commit 79f201b

Browse files
committed
verbos
1 parent 223b2ea commit 79f201b

61 files changed

Lines changed: 491 additions & 464 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/ViewModelToDomainMappingProfile.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public ViewModelToDomainMappingProfile()
7070
* Identity Resource commands
7171
*/
7272
CreateMap<IdentityResource, RegisterIdentityResourceCommand>().ConstructUsing(c => new RegisterIdentityResourceCommand(c));
73-
CreateMap<IdentityResourceViewModel, UpdateIdentityResourceCommand>().ConstructUsing(c => new UpdateIdentityResourceCommand(c, c.OldName));
7473
CreateMap<RemoveIdentityResourceViewModel, RemoveIdentityResourceCommand>().ConstructUsing(c => new RemoveIdentityResourceCommand(c.Name));
7574

7675
/*
@@ -91,7 +90,6 @@ public ViewModelToDomainMappingProfile()
9190
*/
9291
CreateMap<RemoveRoleViewModel, RemoveRoleCommand>().ConstructUsing(c => new RemoveRoleCommand(c.Name));
9392
CreateMap<SaveRoleViewModel, SaveRoleCommand>().ConstructUsing(c => new SaveRoleCommand(c.Name));
94-
CreateMap<UpdateRoleViewModel, UpdateRoleCommand>().ConstructUsing(c => new UpdateRoleCommand(c.Name, c.OldName));
9593
CreateMap<RemoveUserFromRoleViewModel, RemoveUserFromRoleCommand>().ConstructUsing(c => new RemoveUserFromRoleCommand(c.Role, c.Username));
9694

9795
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IApiResourceAppService : IDisposable
1212
Task<IEnumerable<ApiResourceListViewModel>> GetApiResources();
1313
Task<ApiResource> GetDetails(string name);
1414
Task Save(ApiResource model);
15-
Task Update(UpdateApiResourceViewModel model);
15+
Task Update(string id, ApiResource model);
1616
Task Remove(RemoveApiResourceViewModel model);
1717
Task<IEnumerable<SecretViewModel>> GetSecrets(string name);
1818
Task RemoveSecret(RemoveApiSecretViewModel model);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface IIdentityResourceAppService : IDisposable
1111
Task<IEnumerable<IdentityResourceListView>> GetIdentityResources();
1212
Task<IdentityResource> GetDetails(string name);
1313
Task Save(IdentityResource model);
14-
Task Update(IdentityResource model);
14+
Task Update(string resource, IdentityResource model);
1515
Task Remove(RemoveIdentityResourceViewModel model);
1616
}
1717
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
using System;
1+
using Jp.Application.ViewModels.RoleViewModels;
2+
using System;
23
using System.Collections.Generic;
3-
using System.Text;
44
using System.Threading.Tasks;
5-
using Jp.Application.ViewModels;
6-
using Jp.Application.ViewModels.RoleViewModels;
75

86
namespace Jp.Application.Interfaces
97
{
10-
public interface IRoleManagerAppService: IDisposable
8+
public interface IRoleManagerAppService : IDisposable
119
{
1210
Task<IEnumerable<RoleViewModel>> GetAllRoles();
1311
Task Remove(RemoveRoleViewModel model);
1412
Task<RoleViewModel> GetDetails(string name);
1513
Task Save(SaveRoleViewModel model);
16-
Task Update(UpdateRoleViewModel model);
14+
Task Update(string id, UpdateRoleViewModel model);
1715
Task RemoveUserFromRole(RemoveUserFromRoleViewModel model);
1816
}
1917
}

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
4-
using Jp.Application.EventSourcedNormalizers;
1+
using Jp.Application.EventSourcedNormalizers;
52
using Jp.Application.ViewModels;
63
using Jp.Application.ViewModels.RoleViewModels;
74
using Jp.Application.ViewModels.UserViewModels;
85
using Jp.Domain.Core.ViewModels;
9-
using Jp.Domain.Models;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Threading.Tasks;
109

1110
namespace Jp.Application.Interfaces
1211
{
@@ -19,7 +18,7 @@ public interface IUserManageAppService : IDisposable
1918
Task RemoveAccount(RemoveAccountViewModel model);
2019
Task<bool> HasPassword(Guid userId);
2120
Task<IEnumerable<EventHistoryData>> GetHistoryLogs(string username);
22-
21+
2322
Task<UserViewModel> GetUserDetails(string username);
2423
Task<UserViewModel> GetUserAsync(Guid value);
2524
Task UpdateUser(UserViewModel model);
@@ -32,7 +31,7 @@ public interface IUserManageAppService : IDisposable
3231
Task SaveRole(SaveUserRoleViewModel model);
3332
Task<IEnumerable<UserLoginViewModel>> GetLogins(string userName);
3433
Task RemoveLogin(RemoveUserLoginViewModel model);
35-
Task<IEnumerable<UserListViewModel>> GetUsersInRole(string[] role);
34+
Task<IEnumerable<UserListViewModel>> GetUsersInRole(string role);
3635
Task ResetPassword(AdminChangePasswordViewodel model);
3736
Task<ListOfUsersViewModel> GetUsers(PagingViewModel page);
3837
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public Task Save(ApiResource model)
5656
return Bus.SendCommand(command);
5757
}
5858

59-
public Task Update(UpdateApiResourceViewModel model)
59+
public Task Update(string id, ApiResource model)
6060
{
61-
var command = _mapper.Map<UpdateApiResourceCommand>(model);
61+
var command = new UpdateApiResourceCommand(model, id);
6262
return Bus.SendCommand(command);
6363

6464
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Jp.Domain.Commands.Clients;
88
using Jp.Domain.Core.Bus;
99
using Jp.Domain.Interfaces;
10+
using Microsoft.EntityFrameworkCore;
1011
using System;
1112
using System.Collections.Generic;
1213
using System.Linq;
@@ -41,10 +42,11 @@ public ClientAppService(IMapper mapper,
4142
_clientClaimRepository = clientClaimRepository;
4243
}
4344

44-
public Task<IEnumerable<ClientListViewModel>> GetClients()
45+
public async Task<IEnumerable<ClientListViewModel>> GetClients()
4546
{
46-
var resultado = _mapper.Map<IEnumerable<ClientListViewModel>>(_clientRepository.GetAll().AsEnumerable().Select(a => a.ToModel()).OrderBy(a => a.ClientName).ToList());
47-
return Task.FromResult(resultado);
47+
var clients = await _clientRepository.GetAll().OrderBy(a => a.ClientName).ToListAsync();
48+
var resultado = _mapper.Map<IEnumerable<ClientListViewModel>>(clients.Select(a => a.ToModel()));
49+
return resultado;
4850
}
4951

5052
public async Task<Client> GetClientDetails(string clientId)

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
51
using AutoMapper;
62
using IdentityServer4.EntityFramework.Mappers;
73
using IdentityServer4.Models;
84
using Jp.Application.Interfaces;
9-
using Jp.Application.ViewModels;
105
using Jp.Application.ViewModels.IdentityResourceViewModels;
116
using Jp.Domain.Commands.IdentityResource;
127
using Jp.Domain.Core.Bus;
138
using Jp.Domain.Interfaces;
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Linq;
12+
using System.Threading.Tasks;
1413

1514
namespace Jp.Application.Services
1615
{
@@ -51,9 +50,9 @@ public Task Save(IdentityResource model)
5150
return Bus.SendCommand(command);
5251
}
5352

54-
public Task Update(IdentityResource model)
53+
public Task Update(string resource, IdentityResource model)
5554
{
56-
var command = _mapper.Map<UpdateIdentityResourceCommand>(model);
55+
var command = new UpdateIdentityResourceCommand(model, resource);
5756
return Bus.SendCommand(command);
5857
}
5958

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public Task Save(SaveRoleViewModel model)
5757
return Bus.SendCommand(command);
5858
}
5959

60-
public Task Update(UpdateRoleViewModel model)
60+
public Task Update(string id, UpdateRoleViewModel model)
6161
{
62-
var command = _mapper.Map<UpdateRoleCommand>(model);
62+
var command = new UpdateRoleCommand(model.Name , id);
6363
return Bus.SendCommand(command);
6464
}
6565

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public Task RemoveLogin(RemoveUserLoginViewModel model)
157157
return Bus.SendCommand(registerCommand);
158158
}
159159

160-
public async Task<IEnumerable<UserListViewModel>> GetUsersInRole(string[] role)
160+
public async Task<IEnumerable<UserListViewModel>> GetUsersInRole(string role)
161161
{
162162
return _mapper.Map<IEnumerable<UserListViewModel>>(await _userService.GetUserFromRole(role));
163163
}

0 commit comments

Comments
 (0)