feat: add core backend modules, inventory services, and patch scripts for AI Pharmacy API

This commit is contained in:
2026-09-15 11:15:15 +05:30
parent 22a03043ea
commit 1f9378d96c
41 changed files with 1413 additions and 130 deletions
+24
View File
@@ -0,0 +1,24 @@
import { pool } from './src/db/pool';
async function run() {
try {
const { rows: users } = await pool.query("SELECT id FROM users");
for (const user of users) {
const batchNo = "FIX-BATCH-" + user.id.substring(4, 10);
await pool.query(`
INSERT INTO batches (batch_no, tenant_id, product_id, expiry, qty_on_hand, purchase_price)
VALUES ($1, $2, $3, $4, $5, $6)
ON CONFLICT DO NOTHING
`, [batchNo, user.id, 'prd_1789110114931', '2028-12-31', 1000, 10.00]);
console.log(`Added 1000 stock for user ${user.id}`);
}
} catch (e) {
console.error(e);
} finally {
process.exit();
}
}
run();