-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grpc service installer in identity and email project. Add in iJwtService CreateToken method and implement in JwtService . Delete email logic in identity service and implement message pattern logic.
- Loading branch information
1 parent
c189553
commit 095c0e0
Showing
45 changed files
with
207 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
crs/CommonComponents/Contracts/Abstractions/Abstractions.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
syntax = "proto3"; | ||
|
||
package Contracts.Abstractions.Protobuf; | ||
option csharp_namespace = "Contracts.Abstractions"; | ||
|
||
package abstractions; | ||
|
||
|
||
message NotFound {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Common\Common.csproj" /> | ||
<ProjectReference Include="..\EventBus\EventBus.Common\EventBus.Common.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Common\Common.csproj" /> | ||
<ProjectReference Include="..\EventBus\EventBus.Common\EventBus.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Abstractions\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Protobuf Include="Abstractions\Abstractions.proto" GrpcServices="Both" /> | ||
<Protobuf Include="Services\Identity\Identity.proto" GrpcServices="Both" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Google.Protobuf" Version="3.25.2" /> | ||
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" /> | ||
<PackageReference Include="Grpc.Tools" Version="2.61.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |
20 changes: 10 additions & 10 deletions
20
crs/CommonComponents/Contracts/Services/Identity/Identity.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
crs/CommonComponents/EventBus/EventBus.MassTransit.RabbitMQ/GlobalUsings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
global using MassTransit; | ||
global using MassTransit.Configuration; | ||
global using EventBus.Common.Abstractions; | ||
global using Common.Events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
crs/Services/Email/Email.App/Configurations/GrpcServiceInstaller.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Email.App.Configurations; | ||
|
||
internal sealed class GrpcServiceInstaller : IServiceInstaller | ||
{ | ||
public void Install(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
services.AddGrpcClient<IdentityService.IdentityServiceClient>(options => | ||
{ | ||
options.Address = new Uri(Env.IDENTITY_URL); | ||
}); | ||
|
||
services.AddGrpc(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
global using System.Reflection; | ||
global using Common.Application.Abstractions.Messaging.Command; | ||
global using Common.Domain.Primitives.Results; | ||
global using Email.Infrastructure.Email.Abstractions; | ||
global using Email.Infrastructure.Email.Abstractions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
crs/Services/Email/Email.Infrastructure/Email/Services/EmailBaseService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
global using EventBus.MassTransit.Handlers; | ||
global using Contracts.Services.Identity.Commands; | ||
global using MassTransit; | ||
global using MassTransit; | ||
global using MediatR; |
23 changes: 18 additions & 5 deletions
23
...mail/Email.MessageBus/Handlers/Commands/UserCreatedConfirmationEmailSendCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
namespace Email.MessageBus.Handlers.Commands; | ||
using Email.Application.Emails.Commands.SendConfirmationUserMessage; | ||
|
||
public sealed class UserCreatedConfirmationEmailSendCommandHandler | ||
: IntegrationCommandHandler<UserCreatedConfirmationEmailSendCommand> | ||
namespace Email.MessageBus.Handlers.Commands; | ||
|
||
internal sealed class UserCreatedConfirmationEmailSendCommandHandler(ISender sender) | ||
: IntegrationCommandHandler<UserCreatedConfirmationEmailSendCommand> | ||
{ | ||
public override Task Handle(ConsumeContext<UserCreatedConfirmationEmailSendCommand> context) | ||
private readonly ISender _sender = sender; | ||
|
||
public override async Task Handle(ConsumeContext<UserCreatedConfirmationEmailSendCommand> context) | ||
{ | ||
throw new NotImplementedException(); | ||
var request = new SendConfirmationUserMessageCommand( | ||
context.Message.UserId, | ||
context.Message.ReturnUrl); | ||
|
||
var result = await _sender.Send(request); | ||
|
||
if (result.IsFailure) | ||
{ | ||
throw new Exception(result.Error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
global using Grpc.Core; | ||
global using Contracts.Services.Identity; | ||
global using MediatR; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Grpc.Tools" Version="2.61.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\CommonComponents\Contracts\Contracts.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
13 changes: 13 additions & 0 deletions
13
crs/Services/Identity/Idenitty.Grpc/IdentityGrpcService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Idenitty.Grpc; | ||
|
||
public sealed class IdentityGrpcService(ISender sender) : IdentityService.IdentityServiceBase | ||
{ | ||
private readonly ISender _sender = sender; | ||
|
||
public override async Task<User> GetUser(GetUserRequest request, ServerCallContext context) | ||
{ | ||
var result = await _sender.Send(); | ||
|
||
return base.GetUser(request, context); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
crs/Services/Identity/Identity.App/Configurations/GrpcServiceInstaller.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Identity.App.Configurations; | ||
|
||
internal sealed class GrpcServiceInstaller : IServiceInstaller | ||
{ | ||
public void Install(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
services.AddGrpc(); | ||
} | ||
} |
Oops, something went wrong.