feat: implement core dispensing, identity, and integration modules with authentication middleware

This commit is contained in:
2026-09-11 11:21:53 +05:30
parent a579da0f70
commit 22a03043ea
21 changed files with 869 additions and 688 deletions
+9 -3
View File
@@ -1,18 +1,24 @@
const { Pool } = require('pg');
require('dotenv').config();
const pool = new Pool({
connectionString: 'postgres://postgres:csh%402018@localhost:5432/ai_pharmacy'
connectionString: process.env.DATABASE_URL || 'postgres://postgres:csh%402018@localhost:5433/ai_pharmacy'
});
async function run() {
try {
await pool.query('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS reason_code VARCHAR(100)');
await pool.query('ALTER TABLE stock_movements ADD COLUMN IF NOT EXISTS notes TEXT');
console.log('Successfully added columns.');
await pool.query('ALTER TABLE products ADD COLUMN IF NOT EXISTS hsn_code VARCHAR(20)');
await pool.query('ALTER TABLE products ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(50)');
await pool.query('ALTER TABLE drugs ADD COLUMN IF NOT EXISTS tenant_id VARCHAR(50)');
console.log('Successfully added missing database columns.');
} catch (err) {
console.error('Error:', err);
console.error('Error altering database:', err);
} finally {
pool.end();
}
}
run();