Muluhabt ERP modules

This commit is contained in:
Mulu Mehari
2026-08-25 00:11:39 +03:00
parent 5c2100e76d
commit 70171fa9d8
441 changed files with 68587 additions and 214 deletions

View File

@@ -150,10 +150,15 @@ function buildConnectionOptions() {
return {
type: "postgres" as const,
host: process.env.DB_HOST ?? "localhost",
port: parseInt(process.env.DB_PORT ?? "5433", 10),
username: process.env.DB_USER ?? "postgres",
password: process.env.DB_PASSWORD ?? "",
database: process.env.DB_NAME ?? "edr_freight",
port: parseInt(process.env.DB_PORT ?? "5432", 10),
username: process.env.DB_USER ?? "edr",
password: process.env.DB_PASSWORD ?? "edr_secret",
// Single database, schema-separated: freight, passenger, iam, edr_payment and
// audit are schemas inside ONE Postgres database — the deployed topology (the
// production dump `dump-smart_office_prod-*.sql` is the `freight` schema of a
// Smart Office database). Freight owns the `freight` and `iam` schemas here;
// passenger-api and payment-api connect to the same database on their own.
database: process.env.DB_NAME ?? "edr_database",
// NOTE: do NOT pass `extra.options: '-c search_path=...'`. That sends the
// Postgres startup `options` parameter, which connection poolers (PgBouncer /
// proxies fronting the remote edr_dev DB) reject with

View File

@@ -1,12 +1,16 @@
import 'dotenv/config';
import { Client } from 'pg';
async function createSchema() {
// Connects to the single platform database — the same one the app uses — and
// ensures only the schema this app owns. Reads the standard DB_* env so it can
// never drift from config/database.config.ts.
const client = new Client({
host: 'localhost',
port: 5432,
user: 'postgres',
password: '',
database: 'edr_freight',
host: process.env.DB_HOST ?? 'localhost',
port: parseInt(process.env.DB_PORT ?? '5432', 10),
user: process.env.DB_USER ?? 'edr',
password: process.env.DB_PASSWORD ?? 'edr_secret',
database: process.env.DB_NAME ?? 'edr_database',
});
try {