Skip to content

Commit

Permalink
reorg events and commands by module
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 12, 2024
1 parent 0a3849b commit 9a30109
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// send-welcome-email.handler.ts
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { SendWelcomeEmailCommand } from './send-welcome-email.command';
import { AuthMailer } from '@api/modules/auth/services/auth.mailer';
Expand Down
2 changes: 2 additions & 0 deletions api/src/modules/notifications/email/email.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { IEmailServiceToken } from '@api/modules/notifications/email/email-servi
import { NodemailerEmailService } from '@api/modules/notifications/email/nodemailer.email.service';
import { SendWelcomeEmailHandler } from '@api/modules/notifications/email/commands/send-welcome-email.handler';
import { AuthModule } from '@api/modules/auth/auth.module';
import { EmailFailedEventHandler } from '@api/modules/notifications/email/events/handlers/emai-failed-event.handler';

@Module({
imports: [forwardRef(() => AuthModule)],
providers: [
{ provide: IEmailServiceToken, useClass: NodemailerEmailService },
SendWelcomeEmailHandler,
EmailFailedEventHandler,
],
exports: [IEmailServiceToken],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventsHandler, IEventHandler } from '@nestjs/cqrs';
import { EmailFailedEvent } from '../email-failed.event';
import { ApiEventsService } from '@api/modules/api-events/api-events.service';
import { API_EVENT_TYPES } from '@api/modules/api-events/events.enum';
import { EmailFailedEvent } from '@api/modules/notifications/email/events/email-failed.event';

@EventsHandler(EmailFailedEvent)
export class EmailFailedEventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@api/modules/notifications/email/email-service.interface';
import { ConfigService } from '@nestjs/config';
import { EventBus } from '@nestjs/cqrs';
import { EmailFailedEvent } from '@api/modules/api-events/email-failed.event';
import { EmailFailedEvent } from '@api/modules/notifications/email/events/email-failed.event';

@Injectable()
export class NodemailerEmailService implements IEmailServiceInterface {
Expand Down

0 comments on commit 9a30109

Please sign in to comment.