Initial commit 050212

This commit is contained in:
2026-05-02 17:32:19 +03:30
commit 90e61458f7
8 changed files with 992 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import { join } from 'path';
import { DataSourceOptions } from 'typeorm';
/**
* Runtime config for Nest TypeOrmModule.
* After build, __dirname is dist/config; compiled entities live under dist.
*/
export const dataSourceOptions: DataSourceOptions = {
type: 'postgres',
host: process.env.DB_HOST,
port: parseInt(process.env.POSTGRES_PORT || '5432', 10),
username: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
entities: [join(__dirname, '..', '**', '*.entity.{ts,js}')],
migrations: [join(__dirname, '..', 'database', 'migrations', '*.{ts,js}')],
synchronize: process.env.DB_SYNC === 'true',
};
+19
View File
@@ -0,0 +1,19 @@
import 'dotenv/config';
import { join } from 'path';
import { DataSource } from 'typeorm';
/**
* CLI-only DataSource (migration generate/run/revert).
* Paths point at src so migrations stay in TypeScript before build.
*/
export default new DataSource({
type: 'postgres',
host: process.env.DB_HOST,
port: parseInt(process.env.POSTGRES_PORT || '5432', 10),
username: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
entities: [join(__dirname, '..', '**', '*.entity.ts')],
migrations: [join(__dirname, 'migrations', '*.ts')],
synchronize: false,
});
View File