File size: 1,737 Bytes
6f39f03
 
 
 
 
 
 
 
 
 
 
 
 
 
f97bd0c
 
6f39f03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f97bd0c
 
6f39f03
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { AppController } from './app.controller.js';
import { AppService } from './app.service.js';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
import { configuration } from './config/config.js';
import { DatabaseConfigService } from './config/database.js';
import { AppLoggerMiddleware } from './common/middlewares/app-logger.middleware.js';
import { DeviceInfoMiddleware } from './common/middlewares/device-info.middleware.js';
import { UserModule } from './modules/user/user.module.js';
import { BranchModule } from './modules/branch/branch.module.js';
import { AuthenticationModule } from './modules/authentication/authentication.module.js';
import { MenuItemModule } from './modules/menu-item/menu-item.module.js';
import { FeedsModule } from './modules/feeds/feeds.module.js';
import { OrderModule } from './modules/order/order.module.js';
import { BranchMenusModule } from './modules/branch-menus/branch-menus.module.js';
@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      load: [configuration],
    }),
    TypeOrmModule.forRootAsync({
      imports: [ConfigModule],
      useClass: DatabaseConfigService,
    }),
    UserModule,
    BranchModule,
    AuthenticationModule,
    MenuItemModule,
    FeedsModule,
    OrderModule,
    BranchMenusModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer): void {
    consumer.apply(AppLoggerMiddleware).forRoutes('*');
    consumer.apply(DeviceInfoMiddleware).forRoutes('*');
  }
}