2024-07-26 23:33:07 -04:00
|
|
|
import { Module, NestModule } from '@nestjs/common';
|
2024-07-14 20:25:52 -04:00
|
|
|
import { AppController } from './app.controller';
|
|
|
|
import { AppService } from './app.service';
|
2024-07-26 02:31:29 -04:00
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
2024-07-15 14:17:40 -04:00
|
|
|
import config from './config/config';
|
|
|
|
import { MailModule } from './mail/mail.module';
|
2024-07-18 21:59:27 -04:00
|
|
|
import { RedisModule } from './redis/redis.module';
|
|
|
|
import { OpenTelemetryModule } from 'nestjs-otel';
|
2024-07-26 02:31:29 -04:00
|
|
|
import databaseConfig from './config/database.config';
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2024-07-30 16:39:31 -04:00
|
|
|
import { TypeOrmConfigService } from './database/service/database-config.service';
|
2024-07-26 02:31:29 -04:00
|
|
|
import { AuthModule } from './auth/auth.module';
|
|
|
|
import { UserModule } from './user/user.module';
|
|
|
|
import { ServeStaticModule } from '@nestjs/serve-static';
|
|
|
|
import { join } from 'path';
|
2024-07-26 23:33:07 -04:00
|
|
|
import { AuthMiddleware } from './auth/middleware/auth.middleware';
|
|
|
|
import { ClsModule } from 'nestjs-cls';
|
2024-07-30 16:39:31 -04:00
|
|
|
import { BullModule } from '@nestjs/bullmq';
|
|
|
|
import { BullConfigService } from './redis/service/bull-config.service';
|
|
|
|
import { RedisService } from './redis/service/redis.service';
|
2024-10-14 18:21:05 -04:00
|
|
|
import { OrganizationModule } from './organization/organization.module';
|
2024-07-14 20:25:52 -04:00
|
|
|
|
|
|
|
@Module({
|
2024-07-15 14:17:40 -04:00
|
|
|
imports: [
|
2024-07-26 02:31:29 -04:00
|
|
|
OpenTelemetryModule.forRoot({
|
2024-07-18 21:59:27 -04:00
|
|
|
metrics: {
|
|
|
|
apiMetrics: {
|
|
|
|
enable: true,
|
|
|
|
ignoreRoutes: [
|
|
|
|
'/favicon.ico',
|
|
|
|
'/OidcServiceWorker.js',
|
|
|
|
'/swagger',
|
|
|
|
'/swagger-json',
|
|
|
|
'/swagger-yaml',
|
|
|
|
'/swagger/(.*)',
|
|
|
|
'/metrics',
|
|
|
|
'/interaction/(.*}',
|
|
|
|
],
|
|
|
|
ignoreUndefinedRoutes: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
2024-07-15 14:17:40 -04:00
|
|
|
ConfigModule.forRoot({
|
|
|
|
cache: true,
|
|
|
|
isGlobal: true,
|
2024-07-26 02:31:29 -04:00
|
|
|
load: [config, databaseConfig],
|
|
|
|
}),
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
|
|
imports: [ConfigModule],
|
|
|
|
useClass: TypeOrmConfigService,
|
|
|
|
inject: [ConfigService],
|
|
|
|
}),
|
|
|
|
ServeStaticModule.forRoot({
|
|
|
|
serveRoot: '/assets',
|
|
|
|
rootPath: join(__dirname, '..', 'assets'),
|
2024-07-15 14:17:40 -04:00
|
|
|
}),
|
2024-07-26 23:33:07 -04:00
|
|
|
ClsModule.forRoot({
|
|
|
|
global: true,
|
|
|
|
middleware: { mount: false },
|
|
|
|
}),
|
2024-07-18 21:59:27 -04:00
|
|
|
RedisModule,
|
2024-07-30 16:39:31 -04:00
|
|
|
BullModule.forRootAsync({
|
|
|
|
imports: [RedisModule],
|
|
|
|
useClass: BullConfigService,
|
|
|
|
inject: [RedisService],
|
|
|
|
}),
|
|
|
|
MailModule,
|
2024-07-26 02:31:29 -04:00
|
|
|
UserModule,
|
|
|
|
AuthModule,
|
2024-10-14 18:21:05 -04:00
|
|
|
OrganizationModule,
|
2024-07-15 14:17:40 -04:00
|
|
|
],
|
2024-07-14 20:25:52 -04:00
|
|
|
controllers: [AppController],
|
|
|
|
providers: [AppService],
|
|
|
|
})
|
2024-07-26 23:33:07 -04:00
|
|
|
export class AppModule implements NestModule {
|
|
|
|
configure(consumer: import('@nestjs/common').MiddlewareConsumer) {
|
|
|
|
consumer.apply(AuthMiddleware).forRoutes('*');
|
|
|
|
}
|
|
|
|
}
|