2023-05-26 15:43:14 -05:00
|
|
|
import { BullModule } from '@nestjs/bull'
|
|
|
|
|
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'
|
|
|
|
|
import { ScheduleModule } from '@nestjs/schedule'
|
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm'
|
|
|
|
|
import { resolve } from 'path'
|
|
|
|
|
import { ReservationsModule } from './reservations/module'
|
|
|
|
|
import { RunnerModule } from './runner/module'
|
|
|
|
|
import { ConfigModule } from '@nestjs/config'
|
|
|
|
|
import { LoggerMiddleware } from './logger/middleware'
|
|
|
|
|
import { LoggerModule } from './logger/module'
|
|
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
|
imports: [
|
|
|
|
|
TypeOrmModule.forRoot({
|
|
|
|
|
type: 'sqlite',
|
|
|
|
|
database: resolve('./db/autobaan_db'),
|
2023-06-27 17:06:58 +02:00
|
|
|
migrations: [resolve('./database/migrations/*.ts')],
|
2023-05-26 15:43:14 -05:00
|
|
|
autoLoadEntities: true,
|
|
|
|
|
logging: true,
|
|
|
|
|
}),
|
|
|
|
|
BullModule.forRoot({
|
|
|
|
|
redis: {
|
|
|
|
|
host: process.env.REDIS_HOST,
|
|
|
|
|
port: Number.parseInt(process.env.REDIS_PORT || '6379'),
|
|
|
|
|
},
|
|
|
|
|
defaultJobOptions: {
|
|
|
|
|
removeOnComplete: true,
|
2023-06-27 16:06:19 +02:00
|
|
|
},
|
2023-05-26 15:43:14 -05:00
|
|
|
}),
|
|
|
|
|
ScheduleModule.forRoot(),
|
|
|
|
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
|
|
|
ReservationsModule,
|
|
|
|
|
RunnerModule,
|
|
|
|
|
LoggerModule,
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
export class AppModule implements NestModule {
|
|
|
|
|
configure(consumer: MiddlewareConsumer) {
|
|
|
|
|
consumer.apply(LoggerMiddleware).forRoutes('*')
|
|
|
|
|
}
|
|
|
|
|
}
|