using IdentityService.Domain.Events; using IM.Commons.IntegrationEvents; using MassTransit; using MediatR; namespace IdentityService.WebApi.Applications.EventHandler { public class UserProfileUpdateHandler : INotificationHandler { private readonly IPublishEndpoint endpoint; public UserProfileUpdateHandler(IPublishEndpoint endpoint) { this.endpoint = endpoint; } public async Task Handle(UserProfileUpdateDomainEvent notification, CancellationToken cancellationToken) { await endpoint.Publish(new UserProfileUpdateEvent { CorrelationId = notification.User.Id, Avatar = notification.User.Avatar, Description = notification.User.Description, Email = notification.User.Email, NickName = notification.User.NickName, Phone = notification.User.PhoneNumber, Status = notification.User.Status.ToString(), UserId = notification.User.Id }); } } }