import { Module } from '@nestjs/common' ; import { TypeOrmModule } from '@nestjs/typeorm' ; import { ConfigurationService } from './configuration.service' ; import { ConfigurationModule } from './configuration.module' ; @ Module ( { imports : [ TypeOrmModule . forRootAsync ( { imports : [ ConfigurationModule ] , inject : [ ConfigurationService ] , useFactory : ( configService ) => configService . getTypeOrmConfig ( ) , } ) , ] , } ) export class DatabaseModule { }