20 lines
665 B
C#
20 lines
665 B
C#
using Femto.Common.Infrastructure.Outbox;
|
|
using Femto.Modules.Auth.Contracts.Events;
|
|
using Femto.Modules.Auth.Data;
|
|
using Femto.Modules.Auth.Models.Events;
|
|
using MediatR;
|
|
|
|
namespace Femto.Modules.Auth.Models.DomainEventHandlers;
|
|
|
|
internal class UserWasCreatedHandler(Outbox<AuthContext> outbox)
|
|
: INotificationHandler<UserWasCreatedEvent>
|
|
{
|
|
public async Task Handle(UserWasCreatedEvent notification, CancellationToken cancellationToken)
|
|
{
|
|
await outbox.AddMessage(
|
|
notification.User.Id,
|
|
new UserWasCreatedIntegrationEvent(notification.User.Id, notification.User.Username),
|
|
cancellationToken
|
|
);
|
|
}
|
|
}
|