Added user login & registration. Added SQL file for postgres database.
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { TypeOrmModuleOptions, TypeOrmOptionsFactory } from '@nestjs/typeorm';
|
||||
import { SnakeNamingStrategy } from "typeorm-naming-strategies"
|
||||
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DatabaseOptions implements TypeOrmOptionsFactory {
|
||||
constructor(private config: ConfigService) { }
|
||||
|
||||
createTypeOrmOptions(): TypeOrmModuleOptions | Promise<TypeOrmModuleOptions> {
|
||||
return {
|
||||
type: "postgres",
|
||||
host: this.config.getOrThrow('DATABASE_HOST'),
|
||||
port: parseInt(this.config.getOrThrow('DATABASE_PORT'), 10),
|
||||
username: this.config.getOrThrow('DATABASE_USERNAME'),
|
||||
password: this.config.getOrThrow('DATABASE_PASSWORD'),
|
||||
database: this.config.getOrThrow('DATABASE_NAME'),
|
||||
|
||||
entities: [__dirname + '/../**/*.entity.js'],
|
||||
logging: true,
|
||||
synchronize: false,
|
||||
//migrations: ['dist/migrations/*.ts'],
|
||||
// cli: {
|
||||
// migrationsDir: process.env.TYPEORM_MIGRATIONS_DIR,
|
||||
// },
|
||||
namingStrategy: new SnakeNamingStrategy(),
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user