-
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.
- Loading branch information
Showing
24 changed files
with
1,350 additions
and
75 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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: 1 addition & 1 deletion
2
...eanArchitecture.Application/Features/V1/Baskets/Models/Requests/UserInformationRequest.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,6 +1,6 @@ | ||
namespace CleanArchitecture.Application.Features.V1.Baskets.Models.Requests; | ||
|
||
public sealed record UserInformationRequest( | ||
string UserName, | ||
string Name, | ||
string Phone, | ||
AddressRequest Address); |
31 changes: 31 additions & 0 deletions
31
...chitecture.Application/Features/V1/Orders/EventHandlers/OrderCreatedDomainEventHandler.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,31 @@ | ||
using CleanArchitecture.Application.Common.Email; | ||
using CleanArchitecture.Application.Common.Messaging; | ||
using CleanArchitecture.Application.Features.Identities.Users; | ||
using CleanArchitecture.Domain.AggregatesModels.Orders.Events; | ||
|
||
namespace CleanArchitecture.Application.Features.V1.Orders.EventHandlers; | ||
|
||
public sealed class OrderCreatedDomainEventHandler : IDomainEventHandler<OrderCreatedDomainEvent> | ||
{ | ||
private readonly IMailService _mailService; | ||
private readonly IUserService _userService; | ||
public OrderCreatedDomainEventHandler(IMailService mailService, IUserService userService) | ||
{ | ||
_mailService = mailService ?? throw new ArgumentNullException(nameof(mailService)); | ||
_userService = userService ?? throw new ArgumentNullException(nameof(userService)); | ||
} | ||
|
||
public async Task Handle(OrderCreatedDomainEvent notification, CancellationToken cancellationToken) | ||
{ | ||
var user = await _userService.GetAsync(notification.UserId, cancellationToken); | ||
if (user is null) | ||
return; | ||
|
||
var mail = new MailRequest(new List<string> { | ||
user.Email! }, | ||
"Thank you for your purchase", | ||
"Thank you for ordering. We received your order and will begin processing it soon!"); | ||
|
||
await _mailService.SendAsync(mail, cancellationToken); | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
...anArchitecture.Application/Features/V1/Products/Events/ProductUpdateDomainEventHandler.cs
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/Core/CleanArchitecture.Domain/AggregatesModels/Orders/Events/OrderCreatedDomainEvent.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,5 @@ | ||
using CleanArchitecture.Domain.Common; | ||
|
||
namespace CleanArchitecture.Domain.AggregatesModels.Orders.Events; | ||
|
||
public sealed record OrderCreatedDomainEvent(Guid UserId) : 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
5 changes: 0 additions & 5 deletions
5
...re/CleanArchitecture.Domain/AggregatesModels/Products/Events/ProductUpdatedDomainEvent.cs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.