xpeditis2.0/apps/backend/src/application/notifications/notifications.module.ts
2026-09-14 11:19:29 +02:00

46 lines
1.6 KiB
TypeScript

/**
* Notifications Module
*
* Provides notification functionality with WebSocket support
*/
import { Module } from '@nestjs/common';
import { AuthModule } from '../auth/auth.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtModule } from '@nestjs/jwt';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { NotificationsController } from '../controllers/notifications.controller';
import { NotificationsGateway } from '../gateways/notifications.gateway';
import { NotificationService } from '../services/notification.service';
import { NotificationOrmEntity } from '../../infrastructure/persistence/typeorm/entities/notification.orm-entity';
import { TypeOrmNotificationRepository } from '../../infrastructure/persistence/typeorm/repositories/typeorm-notification.repository';
import { NOTIFICATION_REPOSITORY } from '@domain/ports/out/notification.repository';
@Module({
imports: [
AuthModule,
TypeOrmModule.forFeature([NotificationOrmEntity]),
JwtModule.registerAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
secret: configService.get<string>('JWT_SECRET'),
signOptions: {
expiresIn: configService.get<string>('JWT_ACCESS_EXPIRATION', '15m'),
},
}),
inject: [ConfigService],
}),
],
controllers: [NotificationsController],
providers: [
NotificationsGateway,
NotificationService,
{
provide: NOTIFICATION_REPOSITORY,
useClass: TypeOrmNotificationRepository,
},
],
exports: [NotificationService, NotificationsGateway, NOTIFICATION_REPOSITORY],
})
export class NotificationsModule {}