forked from DistinctCodes/AssetsUp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.module.ts
More file actions
43 lines (42 loc) · 1.89 KB
/
app.module.ts
File metadata and controls
43 lines (42 loc) · 1.89 KB
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
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AssetCategoriesModule } from './asset-categories/asset-categories.module';
import { AssetCategory } from './asset-categories/asset-category.entity';
import { DepartmentsModule } from './departments/departments.module';
import { Department } from './departments/department.entity';
import { AssetDepreciationModule } from './asset-depreciation/asset-depreciation.module';
import { AssetDepreciation } from './asset-depreciation/entities/asset-depreciation.entity';
import { ProcurementModule } from './procurement/procurement.module';
import { ProcurementRequest } from './procurement/entities/procurement-request.entity';
import { AssetRegistration } from './procurement/entities/asset-registration.entity';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
}),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
type: 'postgres',
host: configService.get('DB_HOST', 'localhost'),
port: configService.get('DB_PORT', 5432),
username: configService.get('DB_USERNAME', 'postgres'),
password: configService.get('DB_PASSWORD', 'password'),
database: configService.get('DB_DATABASE', 'manage_assets'),
entities: [AssetCategory, Department, AssetDepreciation, ProcurementRequest, AssetRegistration],
synchronize: configService.get('NODE_ENV') !== 'production', // Only for development
}),
inject: [ConfigService],
}),
AssetCategoriesModule,
DepartmentsModule,
AssetDepreciationModule,
ProcurementModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}