Skip to content

Commit

Permalink
refactor event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 18, 2024
1 parent cb3136c commit 2edb8c5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 0 additions & 3 deletions api/src/modules/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { Module } from '@nestjs/common';
import { AdminController } from './admin.controller';
import { AuthModule } from '@api/modules/auth/auth.module';
import { ImportModule } from '@api/modules/import/import.module';
import { NewUserEventHandler } from '@api/modules/admin/events/handlers/new-user-event.handler';
import { PasswordRecoveryRequestedEventHandler } from '@api/modules/admin/events/handlers/password-recovery-requested.handler';

@Module({
imports: [AuthModule, ImportModule],
providers: [NewUserEventHandler, PasswordRecoveryRequestedEventHandler],
controllers: [AdminController],
})
export class AdminModule {}
11 changes: 9 additions & 2 deletions api/src/modules/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ import { AuthMailer } from '@api/modules/auth/services/auth.mailer';
import { NotificationsModule } from '@api/modules/notifications/notifications.module';
import { AuthenticationController } from '@api/modules/auth/authentication.controller';
import { AuthenticationModule } from '@api/modules/auth/authentication.module';
import { RequestPasswordRecoveryHandler } from '@api/modules/auth/commands/request-password-recovery.handler';
import { RequestPasswordRecoveryCommandHandler } from '@api/modules/auth/commands/request-password-recovery-command.handler';
import { NewUserEventHandler } from '@api/modules/admin/events/handlers/new-user-event.handler';
import { PasswordRecoveryRequestedEventHandler } from '@api/modules/auth/events/handlers/password-recovery-requested.handler';

@Module({
imports: [AuthenticationModule, NotificationsModule],
controllers: [AuthenticationController],
providers: [AuthMailer, RequestPasswordRecoveryHandler],
providers: [
AuthMailer,
RequestPasswordRecoveryCommandHandler,
NewUserEventHandler,
PasswordRecoveryRequestedEventHandler,
],
exports: [AuthenticationModule, AuthMailer],
})
export class AuthModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AuthMailer } from '@api/modules/auth/services/auth.mailer';
import { RequestPasswordRecoveryCommand } from '@api/modules/auth/commands/request-password-recovery.command';
import { UsersService } from '@api/modules/users/users.service';
import { NotFoundException } from '@nestjs/common';
import { PasswordRecoveryRequestedEvent } from '@api/modules/admin/events/password-recovery-requested.event';
import { PasswordRecoveryRequestedEvent } from '@api/modules/auth/events/password-recovery-requested.event';

@CommandHandler(RequestPasswordRecoveryCommand)
export class RequestPasswordRecoveryHandler
export class RequestPasswordRecoveryCommandHandler
implements ICommandHandler<RequestPasswordRecoveryCommand>
{
constructor(
Expand Down

0 comments on commit 2edb8c5

Please sign in to comment.