Esempio n. 1
0
        public async Task Handle(EditUserRejectedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new EditUserRejectedIntegrationEvent(@event.RequestId, @event.UserId,
                                                     $"Edit user with id: {@event.UserId} failed.", @event.Reason, @event.Code), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(AvatarRemovedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new AvatarRemovedIntegrationEvent(@event.RequestId, @event.UserId,
                                                  $"Avatar has been successfully removed for user with id: {@event.UserId}"), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Esempio n. 3
0
        public async Task Handle(NewPasswordSetDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new NewPasswordSetIntegrationEvent(@event.RequestId, @event.Email,
                                                   $"Password for user with email: {@event.Email} has been successfully set."), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Esempio n. 4
0
        public async Task Handle(SetNewPasswordRejectedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new SetNewPasswordRejectedIntegrationEvent(@event.RequestId, @event.Code, @event.Reason, @event.Email,
                                                           $"Set password for user with email: {@event.Email} failed."), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(UploadAvatarRejectedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(new UploadAvatarRejectedIntegrationEvent(@event.RequestId,
                                                                                               @event.UserId, $"Error occured when uploading avatar for user with id :{@event.UserId}", @event.Code,
                                                                                               @event.Reason), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(SignUpRejectedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(new SignUpRejectedIntegrationEvent(@event.RequestId,
                                                                                         @event.UserId, $"Sign up for user with id: {@event.UserId} rejected, because exception was thrown.",
                                                                                         @event.Code, @event.Reason), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(TwoFactorAuthenticationDisabledDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new TwoFactorAuthenticationDisabledIntegrationEvent(@event.RequestId, @event.UserId,
                                                                    $"Successfully disabled two factor authentication for user with id: {@event.UserId}."),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Esempio n. 8
0
        public async Task Handle(PasswordChangedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new PasswordChangedIntegrationEvent(@event.RequestId, @event.UserId,
                                                    $"Password for user with id: {@event.UserId} has been changed."),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(SignedInDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new SignedInIntegrationEvent(@event.RequestId, @event.UserId,
                                             $"User with id: {@event.UserId} successfully logged in.", @event.Email, @event.Name),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(ActivateAccountRejectedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new ActivateAccountRejectedIntegrationEvent(@event.RequestId, @event.Email,
                                                            "Activated account rejected, because exception was thrown.", @event.Code, @event.Reason),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(AccountDeletedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new AccountDeletedIntegrationEvent(@event.RequestId, @event.UserId,
                                                   $"Successfully deleted account for user with id: {@event.UserId}.", @event.Soft),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(CreateActivateAccountSecuredOperationRejectedDomainEvent @event,
                                 CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.PublishAsync(
                new CreateActivateAccountSecuredOperationRejectedIntegrationEvent(@event.RequestId, @event.UserId,
                                                                                  @event.OperationId,
                                                                                  $"Created secured operation for user with id: {@event.UserId} rejected, because exception was thrown",
                                                                                  @event.Reason, @event.Code), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
        public async Task Handle(SignedUpDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _mediatRBus.SendAsync(
                new SendActivateAccountMessageCommand(@event.Request, @event.User.Email, @event.User.Username,
                                                      @event.User.Id), cancellationToken);

            await _massTransitBusService.PublishAsync(new SignedUpIntegrationEvent(@event.Request.Id, @event.User.Id,
                                                                                   $"Successfully signed up user with id: {@event.User.Id}.", @event.User.Role, @event.User.State),
                                                      cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Esempio n. 14
0
        public async Task Handle(ActivateAccountSecuredOperationCreatedDomainEvent @event,
                                 CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            await _massTransitBusService.SendAsync(new SendActivateAccountMessageIntegrationCommand(@event.Request,
                                                                                                    @event.Email, @event.Username, @event.Token, @event.Endpoint), cancellationToken);

            await _massTransitBusService.PublishAsync(
                new ActivateAccountSecuredOperationCreatedIntegrationEvent(@event.Request.Id, @event.UserId,
                                                                           @event.OperationId, $"Successfully created secured operation for user with id: {@event.UserId}."),
                cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }
Esempio n. 15
0
        public async Task Handle(ResetPasswordInitiatedDomainEvent @event, CancellationToken cancellationToken)
        {
            _logger.LogInformation("----- Handling domain event {DomainEventName} ({@Event})",
                                   @event.GetGenericTypeName(), @event);

            var operation = await _oneTimeSecuredOperationService.GetAsync(@event.OperationId);

            await _massTransitBusService.PublishAsync(
                new ResetPasswordInitiatedIntegrationEvent(@event.Request.Id, @event.OperationId, @event.Email,
                                                           @event.Endpoint,
                                                           $"Reset password for user with email: {@event.Email} initiated."),
                cancellationToken);

            await _massTransitBusService.SendAsync(
                new SendResetPasswordMessageIntegrationCommand(@event.Request, @event.Email, operation.Token,
                                                               @event.Endpoint), cancellationToken);

            _logger.LogInformation("----- Domain event {DomainEvent} handled", @event.GetGenericTypeName());
        }