2026-02-14 19:33:09 +03:00
|
|
|
import { Module } from '@nestjs/common';
|
|
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
|
|
|
import { Password } from 'src/admins/entities/password.entity';
|
|
|
|
|
import { Admin } from 'src/admins/entities/admin.entity';
|
2026-02-17 16:24:30 +03:00
|
|
|
import { User } from 'src/users/entities/user.entity';
|
2026-02-14 19:33:09 +03:00
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
|
imports: [
|
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
|
|
|
imports: [ConfigModule],
|
|
|
|
|
inject: [ConfigService],
|
|
|
|
|
useFactory: (configService: ConfigService) => ({
|
|
|
|
|
type: 'postgres',
|
|
|
|
|
host: configService.get('DB_HOST'),
|
|
|
|
|
port: configService.get('DB_PORT'),
|
|
|
|
|
username: configService.get('DB_USERNAME'),
|
|
|
|
|
password: configService.get('DB_PASSWORD'),
|
|
|
|
|
database: configService.get('DB_NAME'),
|
|
|
|
|
synchronize: false,
|
|
|
|
|
logging: false,
|
|
|
|
|
subscribers: [],
|
|
|
|
|
entities: [
|
|
|
|
|
Admin,
|
|
|
|
|
Password,
|
2026-02-17 16:24:30 +03:00
|
|
|
User,
|
2026-02-14 19:33:09 +03:00
|
|
|
]
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
export class DatabaseModule {}
|