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

Commit 006f4a9

Browse files
Merge pull request #34 from brunohbrito/dev
PostgreSql + Bug Fixes
2 parents 677bf74 + be9b9d0 commit 006f4a9

File tree

87 files changed

+3439
-389
lines changed

Some content is hidden

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

87 files changed

+3439
-389
lines changed

api.dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ EXPOSE 5003
66
FROM microsoft/dotnet:2.2-sdk AS build
77
WORKDIR /src
88
COPY ["src/Backend/Jp.UserManagement/Jp.Management.csproj", "Backend/Jp.UserManagement/"]
9-
COPY ["src/Backend/Jp.Infra.Migrations.Sql/Jp.Infra.Migrations.Sql.csproj", "Backend/Jp.Infra.Migrations.Sql/"]
10-
COPY ["src/Backend/Jp.Infra.Data/Jp.Infra.Data.csproj", "Backend/Jp.Infra.Data/"]
9+
COPY ["src/Backend/Jp.Application/Jp.Application.csproj", "Backend/Jp.Application/"]
1110
COPY ["src/Backend/Jp.Domain.Core/Jp.Domain.Core.csproj", "Backend/Jp.Domain.Core/"]
1211
COPY ["src/Backend/Jp.Domain/Jp.Domain.csproj", "Backend/Jp.Domain/"]
12+
COPY ["src/Backend/Jp.Infra.Data/Jp.Infra.Data.csproj", "Backend/Jp.Infra.Data/"]
13+
COPY ["src/Backend/Jp.Infra.Data.MySql/Jp.Infra.Data.MySql.csproj", "Backend/Jp.Infra.Data.MySql/"]
14+
COPY ["src/Backend/Jp.Infra.Data.Sql/Jp.Infra.Data.Sql.csproj", "Backend/Jp.Infra.Data.Sql/"]
15+
COPY ["src/Backend/Jp.Infra.Data.PostgreSQL/Jp.Infra.Data.PostgreSQL.csproj", "Backend/Jp.Infra.Data.PostgreSQL/"]
1316
COPY ["src/Backend/Jp.Infra.CrossCutting.Bus/Jp.Infra.CrossCutting.Bus.csproj", "Backend/Jp.Infra.CrossCutting.Bus/"]
17+
COPY ["src/Backend/Jp.Infra.CrossCutting.Database/Jp.Infra.CrossCutting.Database.csproj", "Backend/Jp.Infra.CrossCutting.Database/"]
1418
COPY ["src/Backend/Jp.Infra.CrossCutting.Identity/Jp.Infra.CrossCutting.Identity.csproj", "Backend/Jp.Infra.CrossCutting.Identity/"]
15-
COPY ["src/Backend/Jp.Application/Jp.Application.csproj", "Backend/Jp.Application/"]
1619
COPY ["src/Backend/Jp.Infra.CrossCutting.IoC/Jp.Infra.CrossCutting.IoC.csproj", "Backend/Jp.Infra.CrossCutting.IoC/"]
1720
COPY ["src/Backend/Jp.Infra.CrossCutting.Tools/Jp.Infra.CrossCutting.Tools.csproj", "Backend/Jp.Infra.CrossCutting.Tools/"]
18-
COPY ["src/Backend/Jp.Infra.Migrations.MySql/Jp.Infra.Migrations.MySql.csproj", "Backend/Jp.Infra.Migrations.MySql/"]
1921

2022
RUN dotnet restore "Backend/Jp.UserManagement/Jp.Management.csproj"
2123
COPY src/. .

db.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"notifications": [
3+
{ "icon": "text-info fas fa-kiwi-bird", "title": "Session", "description": "2019-05 UI Session improvements" },
4+
{ "icon": "text-warning fab fa-docker", "title": "Docker", "description": "2019-04 Docker Ready" },
5+
{ "icon": "text-info fas fa-code-branch", "title": "NET Core 2.2", "description": "2019-03 Updated to ASP.NET Core 2.2" },
6+
{ "icon": "text-success fas fa-id-card", "title": "ID4", "description": "2019-03 IdentityServer4 2.4 Components" },
7+
{ "icon": "text-danger fas fa-rocket", "title": "Launch", "description": "2018-10 first release" }
8+
]
9+
}

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ services:
99
image: mysql
1010
command: --default-authentication-plugin=mysql_native_password
1111
restart: always
12+
expose:
13+
- "3306"
1214
environment:
1315
MYSQL_ROOT_PASSWORD: root
1416
MYSQL_USER: jp

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public ViewModelToDomainMappingProfile()
5151
CreateMap<SaveUserRoleViewModel, SaveUserRoleCommand>().ConstructUsing(c => new SaveUserRoleCommand(c.Username, c.Role));
5252
CreateMap<RemoveUserLoginViewModel, RemoveUserLoginCommand>().ConstructUsing(c => new RemoveUserLoginCommand(c.Username, c.LoginProvider, c.ProviderKey));
5353
CreateMap<AdminChangePasswordViewodel, AdminChangePasswordCommand>().ConstructUsing(c => new AdminChangePasswordCommand(c.Password, c.ConfirmPassword, c.Username));
54-
54+
5555
/*
5656
* Client commands
5757
*/
@@ -65,19 +65,19 @@ public ViewModelToDomainMappingProfile()
6565
CreateMap<RemoveClientViewModel, RemoveClientCommand>().ConstructUsing(c => new RemoveClientCommand(c.ClientId));
6666
CreateMap<CopyClientViewModel, CopyClientCommand>().ConstructUsing(c => new CopyClientCommand(c.ClientId));
6767
CreateMap<SaveClientViewModel, SaveClientCommand>().ConstructUsing(c => new SaveClientCommand(c.ClientId, c.ClientName, c.ClientUri, c.LogoUri, c.Description, c.ClientType));
68-
68+
6969
/*
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));
73+
CreateMap<IdentityResourceViewModel, UpdateIdentityResourceCommand>().ConstructUsing(c => new UpdateIdentityResourceCommand(c, c.OldName));
7474
CreateMap<RemoveIdentityResourceViewModel, RemoveIdentityResourceCommand>().ConstructUsing(c => new RemoveIdentityResourceCommand(c.Name));
7575

7676
/*
7777
* Api Resource commands
7878
*/
7979
CreateMap<ApiResource, RegisterApiResourceCommand>().ConstructUsing(c => new RegisterApiResourceCommand(c));
80-
CreateMap<ApiResource, UpdateApiResourceCommand>().ConstructUsing(c => new UpdateApiResourceCommand(c));
80+
CreateMap<UpdateApiResourceViewModel, UpdateApiResourceCommand>().ConstructUsing(c => new UpdateApiResourceCommand(c, c.OldApiResourceId));
8181
CreateMap<RemoveApiResourceViewModel, RemoveApiResourceCommand>().ConstructUsing(c => new RemoveApiResourceCommand(c.Name));
8282

8383
CreateMap<SaveApiSecretViewModel, SaveApiSecretCommand>().ConstructUsing(c => new SaveApiSecretCommand(c.ResourceName, c.Description, c.Value, c.Type, c.Expiration, (int)c.Hash.GetValueOrDefault(HashType.Sha256)));

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using IdentityServer4.Models;
22
using Jp.Application.ViewModels;
33
using Jp.Application.ViewModels.ApiResouceViewModels;
4-
using Jp.Application.ViewModels.IdentityResourceViewModels;
54
using System;
65
using System.Collections.Generic;
76
using System.Threading.Tasks;
@@ -13,7 +12,7 @@ public interface IApiResourceAppService : IDisposable
1312
Task<IEnumerable<ApiResourceListViewModel>> GetApiResources();
1413
Task<ApiResource> GetDetails(string name);
1514
Task Save(ApiResource model);
16-
Task Update(ApiResource model);
15+
Task Update(UpdateApiResourceViewModel model);
1716
Task Remove(RemoveApiResourceViewModel model);
1817
Task<IEnumerable<SecretViewModel>> GetSecrets(string name);
1918
Task RemoveSecret(RemoveApiSecretViewModel model);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Jp.Application.Interfaces;
55
using Jp.Application.ViewModels;
66
using Jp.Application.ViewModels.ApiResouceViewModels;
7-
using Jp.Application.ViewModels.IdentityResourceViewModels;
87
using Jp.Domain.Commands.ApiResource;
98
using Jp.Domain.Core.Bus;
109
using Jp.Domain.Interfaces;
@@ -57,7 +56,7 @@ public Task Save(ApiResource model)
5756
return Bus.SendCommand(command);
5857
}
5958

60-
public Task Update(ApiResource model)
59+
public Task Update(UpdateApiResourceViewModel model)
6160
{
6261
var command = _mapper.Map<UpdateApiResourceCommand>(model);
6362
return Bus.SendCommand(command);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Jp.Domain.Commands.User;
66
using Jp.Domain.Core.Bus;
77
using Jp.Domain.Interfaces;
8-
using Jp.Domain.Models;
98
using System;
109
using System.Threading.Tasks;
1110

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using IdentityServer4.Models;
2+
3+
namespace Jp.Application.ViewModels.ApiResouceViewModels
4+
{
5+
public class UpdateApiResourceViewModel : ApiResource
6+
{
7+
public string OldApiResourceId { get; set; }
8+
}
9+
}

src/Backend/Jp.Domain.Core/Jp.Domain.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="mediatr" Version="6.0.0" />
9-
<PackageReference Include="FluentValidation" Version="8.2.0" />
8+
<PackageReference Include="mediatr" Version="7.0.0" />
9+
<PackageReference Include="FluentValidation" Version="8.4.0" />
1010
</ItemGroup>
1111

1212
</Project>

src/Backend/Jp.Domain/CommandHandlers/ApiResourceCommandHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public async Task<bool> Handle(UpdateApiResourceCommand request, CancellationTok
7373
return false;
7474
}
7575

76-
var savedClient = await _apiResourceRepository.GetResource(request.Resource.Name);
76+
var savedClient = await _apiResourceRepository.GetResource(request.OldResourceName);
7777
if (savedClient == null)
7878
{
7979
await Bus.RaiseEvent(new DomainNotification("1", "Resource not found"));
@@ -237,7 +237,7 @@ public async Task<bool> Handle(SaveApiScopeCommand request, CancellationToken ca
237237
Emphasize = request.Emphasize,
238238
Name = request.Name,
239239
ShowInDiscoveryDocument = request.ShowInDiscoveryDocument,
240-
UserClaims = request.UserClaims.Select(s => new ApiScopeClaim(){ Type = s}).ToList(),
240+
UserClaims = request.UserClaims.Select(s => new ApiScopeClaim() { Type = s }).ToList(),
241241
};
242242

243243
_apiScopeRepository.Add(secret);

0 commit comments

Comments
 (0)