-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new functionality to multiple services
This commit introduces significant changes to various services. It adds a new messaging system with MassTransit implementation for the Contracts.Abstractions. New proto3 files have been created for Account, Catalog, and Notification services. Detailed boundary definitions have been added, including commands, events, queries, and their respective validations where necessary. It further involves changes relating to the Order service and Identity service, including authentication and user management functionality.
- Loading branch information
1 parent
89c147e
commit d87963f
Showing
506 changed files
with
14,064 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,115 @@ | ||
<Project> | ||
<PropertyGroup Label="Common properties"> | ||
<Product>Eventual Shop</Product> | ||
<Copyright>Copyright (c) 2021-2023 Antonio Falcão Jr.</Copyright> | ||
<Authors>Antônio Falcão Jr.</Authors> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<LangVersion>preview</LangVersion> | ||
<EnablePreviewFeatures>true</EnablePreviewFeatures> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<!--<TreatWarningsAsErrors>true</TreatWarningsAsErrors>--> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
<ItemGroup Label="Packages"> | ||
<!--Ardalis.SmartEnum--> | ||
<PackageVersion Include="Ardalis.SmartEnum" Version="7.0.0" /> | ||
<PackageVersion Include="Ardalis.SmartEnum.AutoFixture" Version="7.0.0" /> | ||
<PackageVersion Include="Ardalis.SmartEnum.SystemTextJson" Version="7.0.0" /> | ||
<!--Asp.Versioning--> | ||
<PackageVersion Include="Asp.Versioning.Http" Version="7.1.0" /> | ||
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="7.1.0" /> | ||
<!--AutoFixture--> | ||
<PackageVersion Include="AutoFixture" Version="4.18.0" /> | ||
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.0" /> | ||
<PackageVersion Include="BlazorStrap" Version="5.2.100-Preview3b" /> | ||
<!--BlazorStrap--> | ||
<PackageVersion Include="BlazorStrap.V5" Version="5.2.100-Preview3b" /> | ||
<!--CorrelationId--> | ||
<PackageVersion Include="CorrelationId" Version="3.0.1" /> | ||
<!--Coverlet--> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.0" /> | ||
<!--FluentAssertions--> | ||
<PackageVersion Include="FluentAssertions" Version="7.0.0-alpha.3" /> | ||
<PackageVersion Include="FluentResults" Version="3.15.2" /> | ||
<!--FluentValidation--> | ||
<PackageVersion Include="FluentValidation" Version="11.8.0" /> | ||
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" /> | ||
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0" /> | ||
<!--Fluxor--> | ||
<PackageVersion Include="Fluxor" Version="5.9.1" /> | ||
<PackageVersion Include="Fluxor.Blazor.Web" Version="5.9.1" /> | ||
<PackageVersion Include="Fluxor.Blazor.Web.ReduxDevTools" Version="5.9.1" /> | ||
<!--Grpc--> | ||
<PackageVersion Include="Google.Protobuf" Version="3.25.0" /> | ||
<PackageVersion Include="Grpc.AspNetCore" Version="2.59.0" /> | ||
<PackageVersion Include="Grpc.AspNetCore.Server" Version="2.56.0-pre1" /> | ||
<PackageVersion Include="Grpc.AspNetCore.Server.ClientFactory" Version="2.59.0" /> | ||
<PackageVersion Include="Grpc.Net.Client" Version="2.59.0" /> | ||
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.59.0" /> | ||
<PackageVersion Include="Grpc.Tools" Version="2.59.0" /> | ||
<!--JsonNet--> | ||
<PackageVersion Include="JsonNet.ContractResolvers" Version="2.0.0" /> | ||
<PackageVersion Include="LanguageExt.Core" Version="4.4.7" /> | ||
<!--MassTransit--> | ||
<PackageVersion Include="MassTransit" Version="8.1.2-develop.1590" /> | ||
<PackageVersion Include="MassTransit.Newtonsoft" Version="8.1.2-develop.1590" /> | ||
<PackageVersion Include="MassTransit.Quartz" Version="8.1.2-develop.1590" /> | ||
<PackageVersion Include="MassTransit.RabbitMQ" Version="8.1.2-develop.1590" /> | ||
<!--MediatR--> | ||
<PackageVersion Include="MediatR" Version="12.1.1" /> | ||
<!--MicroElements.Swashbuckle--> | ||
<PackageVersion Include="MicroElements.Swashbuckle.FluentValidation" Version="6.0.0-beta.3" /> | ||
<!--Microsoft.AspNetCore--> | ||
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0-alpha.1.23558.19" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0-alpha.1.23558.19" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0-alpha.1.23560.2" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-alpha.1.23560.2" /> | ||
<!--Microsoft.EntityFrameworkCore--> | ||
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0-alpha.1.23559.7" /> | ||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-alpha.1.23559.7" /> | ||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0-alpha.1.23559.7" /> | ||
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0-alpha.1.23559.7" /> | ||
<!--Microsoft.Extensions--> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-preview.3.23174.8" /> | ||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-ci" /> | ||
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0-ci" /> | ||
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="9.0.0-alpha.1.23560.2" /> | ||
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.0-ci" /> | ||
<!--Microsoft.NET.Test--> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23531-01" /> | ||
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.1-alpha.1.23158.1" /> | ||
<!--MongoDB--> | ||
<PackageVersion Include="MongoDB.Bson" Version="2.22.0" /> | ||
<PackageVersion Include="MongoDB.Driver" Version="2.22.0" /> | ||
<!--Newtonsoft--> | ||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> | ||
<!--OpenTelemetry--> | ||
<PackageVersion Include="OpenTelemetry.Exporter.Jaeger" Version="1.6.0-rc.1" /> | ||
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0-alpha.1" /> | ||
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.6.0-beta.2" /> | ||
<!--Polly--> | ||
<PackageVersion Include="Polly" Version="8.1.0" /> | ||
<!--Quartz--> | ||
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.7.0" /> | ||
<PackageVersion Include="Quartz.Serialization.Json" Version="3.7.0" /> | ||
<PackageVersion Include="Refit" Version="7.0.0" /> | ||
<PackageVersion Include="Refit.HttpClientFactory" Version="7.0.0" /> | ||
<!--Serilog--> | ||
<PackageVersion Include="Serilog" Version="3.1.1" /> | ||
<PackageVersion Include="Serilog.AspNetCore" Version="7.0.1-dev-00320" /> | ||
<PackageVersion Include="Serilog.Extensions.Hosting" Version="7.0.0" /> | ||
<PackageVersion Include="Serilog.Settings.Configuration" Version="7.0.2-dev-00546" /> | ||
<PackageVersion Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" /> | ||
<!--Swashbuckle--> | ||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" /> | ||
<PackageVersion Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" /> | ||
<!--System.IdentityModel--> | ||
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.1.0-preview" /> | ||
<PackageVersion Include="Ulid" Version="1.3.3" /> | ||
<!--xUnit--> | ||
<PackageVersion Include="xunit" Version="2.6.1" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" /> | ||
</ItemGroup> | ||
</Project> |
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 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BRL/@EntryIndexedValue">BRL</s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CAD/@EntryIndexedValue">CAD</s:String></wpf:ResourceDictionary> |
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,6 @@ | ||
using MassTransit; | ||
|
||
namespace Contracts.Abstractions.Messages; | ||
|
||
[ExcludeFromTopology] | ||
public abstract record Event : Message, IEvent; |
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,41 @@ | ||
syntax = "proto3"; | ||
|
||
package Contracts.Services.Account.Protobuf; | ||
|
||
import "Abstractions/Abstractions.proto"; | ||
|
||
service AccountService { | ||
rpc GetAccountDetails(GetAccountDetailsRequest) returns (Abstractions.Protobuf.GetResponse); | ||
rpc ListAccountsDetails(ListAccountsDetailsRequest) returns (Abstractions.Protobuf.ListResponse); | ||
rpc ListShippingAddressesListItems(ListShippingAddressesListItemsRequest) returns (Abstractions.Protobuf.ListResponse); | ||
} | ||
|
||
// Requests | ||
|
||
message GetAccountDetailsRequest { | ||
string AccountId = 1; | ||
} | ||
|
||
message ListAccountsDetailsRequest { | ||
Abstractions.Protobuf.Paging Paging = 1; | ||
} | ||
|
||
message ListShippingAddressesListItemsRequest { | ||
string AccountId = 1; | ||
Abstractions.Protobuf.Paging Paging = 2; | ||
} | ||
|
||
// Projections | ||
|
||
message AccountDetails { | ||
string AccountId = 1; | ||
string FirstName = 2; | ||
string LastName = 3; | ||
string Email = 4; | ||
} | ||
|
||
message AddressListItem { | ||
string AddressId = 1; | ||
string AccountId = 2; | ||
Abstractions.Protobuf.Address Address = 3; | ||
} |
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,25 @@ | ||
using Contracts.Abstractions.Messages; | ||
using Contracts.DataTransferObjects; | ||
|
||
namespace Contracts.Boundaries.Account; | ||
|
||
public static class Command | ||
{ | ||
public record CreateAccount(string FirstName, string LastName, string Email) : Message, ICommand; | ||
|
||
public record AddShippingAddress(Guid AccountId, Dto.Address Address) : Message, ICommand; | ||
|
||
public record AddBillingAddress(Guid AccountId, Dto.Address Address) : Message, ICommand; | ||
|
||
public record DeleteAccount(Guid AccountId) : Message, ICommand; | ||
|
||
public record DeleteShippingAddress(Guid AccountId, Guid AddressId) : Message, ICommand; | ||
|
||
public record DeleteBillingAddress(Guid AccountId, Guid AddressId) : Message, ICommand; | ||
|
||
public record PreferShippingAddress(Guid AccountId, Guid AddressId) : Message, ICommand; | ||
|
||
public record PreferBillingAddress(Guid AccountId, Guid AddressId) : Message, ICommand; | ||
|
||
public record ActiveAccount(Guid AccountId) : Message, ICommand; | ||
} |
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,35 @@ | ||
using Contracts.Abstractions.Messages; | ||
using Contracts.DataTransferObjects; | ||
|
||
namespace Contracts.Boundaries.Account; | ||
|
||
public static class DomainEvent | ||
{ | ||
public record AccountDeleted(Guid AccountId, string Status, string Version) : Message, IDomainEvent; | ||
|
||
public record BillingAddressDeleted(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record ShippingAddressDeleted(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record AccountDeactivated(Guid AccountId, string Status, string Version) : Message, IDomainEvent; | ||
|
||
public record AccountCreated(Guid AccountId, string FirstName, string LastName, string Email, string Status, string Version) : Message, IDomainEvent; | ||
|
||
public record AccountActivated(Guid AccountId, string Status, string Version) : Message, IDomainEvent; | ||
|
||
public record BillingAddressAdded(Guid AccountId, Guid AddressId, Dto.Address Address, string Version) : Message, IDomainEvent; | ||
|
||
public record BillingAddressRestored(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record ShippingAddressAdded(Guid AccountId, Guid AddressId, Dto.Address Address, string Version) : Message, IDomainEvent; | ||
|
||
public record ShippingAddressRestored(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record BillingAddressPreferred(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record ShippingAddressPreferred(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record PrimaryBillingAddressRemoved(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
|
||
public record PrimaryShippingAddressRemoved(Guid AccountId, Guid AddressId, string Version) : Message, IDomainEvent; | ||
} |
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,38 @@ | ||
using Contracts.Abstractions; | ||
using Contracts.DataTransferObjects; | ||
|
||
namespace Contracts.Boundaries.Account; | ||
|
||
public static class Projection | ||
{ | ||
public record AccountDetails(Guid Id, string FirstName, string LastName, string Email, string Status, bool IsDeleted, ulong Version) : IProjection | ||
{ | ||
public static implicit operator Services.Account.Protobuf.AccountDetails(AccountDetails account) | ||
=> new() | ||
{ | ||
AccountId = account.Id.ToString(), | ||
FirstName = account.FirstName, | ||
LastName = account.LastName, | ||
Email = account.Email | ||
}; | ||
} | ||
|
||
public record BillingAddressListItem(Guid Id, Guid AccountId, Dto.Address Address, bool IsDeleted, ulong Version) | ||
: AddressListItem(Id, AccountId, Address, IsDeleted, Version); | ||
|
||
public record ShippingAddressListItem(Guid Id, Guid AccountId, Dto.Address Address, bool IsDeleted, ulong Version) | ||
: AddressListItem(Id, AccountId, Address, IsDeleted, Version); | ||
|
||
public abstract record AddressListItem(Guid Id, Guid AccountId, Dto.Address Address, bool IsDeleted, ulong Version) : IProjection | ||
{ | ||
public static implicit operator Services.Account.Protobuf.AddressListItem(AddressListItem item) | ||
{ | ||
return new() | ||
{ | ||
AddressId = item.Id.ToString(), | ||
AccountId = item.AccountId.ToString(), | ||
Address = item.Address | ||
}; | ||
} | ||
} | ||
} |
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,26 @@ | ||
using Contracts.Abstractions.Messages; | ||
using Contracts.Abstractions.Paging; | ||
using Contracts.Services.Account.Protobuf; | ||
|
||
namespace Contracts.Boundaries.Account; | ||
|
||
public static class Query | ||
{ | ||
public record GetAccountDetails(Guid AccountId) : IQuery | ||
{ | ||
public static implicit operator GetAccountDetails(GetAccountDetailsRequest request) | ||
=> new(new Guid(request.AccountId)); | ||
} | ||
|
||
public record ListAccountsDetails(Paging Paging) : IQuery | ||
{ | ||
public static implicit operator ListAccountsDetails(ListAccountsDetailsRequest request) | ||
=> new(request.Paging); | ||
} | ||
|
||
public record ListShippingAddressesListItems(Guid AccountId, Paging Paging) : IQuery | ||
{ | ||
public static implicit operator ListShippingAddressesListItems(ListShippingAddressesListItemsRequest request) | ||
=> new(new(request.AccountId), request.Paging); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/Contracts/Boundaries/Cataloging/Catalog/CatalogingQuery.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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
syntax = "proto3"; | ||
|
||
package Contracts.Services.Cataloging.Query.Protobuf; | ||
|
||
import "Abstractions/Abstractions.proto"; | ||
|
||
service CatalogingQueryService { | ||
rpc GetCatalogItemDetails(GetCatalogItemDetailsRequest) returns (Abstractions.Protobuf.GetResponse); | ||
rpc ListCatalogsGridItems(ListCatalogsGridItemsRequest) returns (Abstractions.Protobuf.ListResponse); | ||
rpc ListCatalogItemsCards(ListCatalogItemsCardsRequest) returns (Abstractions.Protobuf.ListResponse); | ||
rpc ListCatalogItemsListItems(ListCatalogItemsListItemsRequest) returns (Abstractions.Protobuf.ListResponse); | ||
} | ||
|
||
// Requests | ||
|
||
message ListCatalogsGridItemsRequest { | ||
Abstractions.Protobuf.Paging Paging = 1; | ||
} | ||
|
||
message ListCatalogItemsListItemsRequest { | ||
string CatalogId = 1; | ||
Abstractions.Protobuf.Paging Paging = 2; | ||
} | ||
|
||
message ListCatalogItemsCardsRequest { | ||
string CatalogId = 1; | ||
Abstractions.Protobuf.Paging Paging = 2; | ||
} | ||
|
||
message GetCatalogItemDetailsRequest { | ||
string CatalogId = 1; | ||
string ItemId = 2; | ||
} | ||
|
||
// Projections | ||
|
||
message CatalogGridItem { | ||
string CatalogId = 1; | ||
string Title = 2; | ||
string Description = 3; | ||
string ImageUrl = 4; | ||
bool IsActive = 5; | ||
} | ||
|
||
message CatalogItemListItem { | ||
string CatalogId = 1; | ||
string ItemId = 2; | ||
string ProductName = 3; | ||
} | ||
|
||
message CatalogItemCard { | ||
string CatalogId = 1; | ||
string ItemId = 2; | ||
Abstractions.Protobuf.Product Product = 3; | ||
string Description = 4; | ||
string ImageUrl = 5; | ||
Abstractions.Protobuf.Money UnitPrice = 6; | ||
} | ||
|
||
message CatalogItemDetails { | ||
string CatalogId = 1; | ||
string ItemId = 2; | ||
string Description = 3; | ||
string ImageUrl = 4; | ||
Abstractions.Protobuf.Product Product = 5; | ||
Abstractions.Protobuf.Money UnitPrice = 6; | ||
} |
Oops, something went wrong.