mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 15:30:56 +00:00
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { HttpModule } from '@nestjs/axios';
|
|
import { ClientsModule, Transport } from '@nestjs/microservices';
|
|
import { NotificationsController } from './notifications.controller';
|
|
import { NotificationsService } from './notifications.service';
|
|
import { PushAdapter } from './notification.adapters';
|
|
import { EmailClientService } from './email-client.service';
|
|
import { SmsClientService } from './sms-client.service';
|
|
|
|
@Module({
|
|
imports: [
|
|
// Required by IamGuard (injects HttpService) used in NotificationsController.
|
|
HttpModule.register({ timeout: 10_000 }),
|
|
ClientsModule.register([
|
|
{
|
|
name: 'EMAIL_SERVICE',
|
|
transport: Transport.RMQ,
|
|
options: {
|
|
urls: [process.env.RABBITMQ_URL as string],
|
|
queue: process.env.EMAIL_QUEUE ?? 'email_queue',
|
|
queueOptions: { durable: true },
|
|
},
|
|
},
|
|
{
|
|
name: 'SMS_SERVICE',
|
|
transport: Transport.RMQ,
|
|
options: {
|
|
urls: [process.env.RABBITMQ_URL as string],
|
|
queue: process.env.SMS_QUEUE ?? 'sms_queue',
|
|
queueOptions: { durable: true },
|
|
},
|
|
},
|
|
]),
|
|
],
|
|
controllers: [NotificationsController],
|
|
providers: [
|
|
NotificationsService,
|
|
PushAdapter,
|
|
EmailClientService,
|
|
SmsClientService,
|
|
],
|
|
exports: [NotificationsService, EmailClientService, SmsClientService],
|
|
})
|
|
export class NotificationsModule {}
|