feat: add core backend modules, inventory services, and patch scripts for AI Pharmacy API
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { seedDummyInventoryForTenant } from '../src/db/seedTenant';
|
||||
import { pool } from '../src/db/pool';
|
||||
|
||||
async function test() {
|
||||
const testTenant = 'hosp_demo_' + Date.now();
|
||||
console.log('Testing seeding for tenant:', testTenant);
|
||||
|
||||
await seedDummyInventoryForTenant(testTenant);
|
||||
|
||||
const suppliers = await pool.query('SELECT * FROM suppliers WHERE tenant_id = $1', [testTenant]);
|
||||
console.log('Suppliers seeded count:', suppliers.rows.length);
|
||||
suppliers.rows.forEach(s => console.log(' Supplier:', s.name, 'ID:', s.id));
|
||||
|
||||
const batches = await pool.query(`
|
||||
SELECT b.batch_no, b.qty_on_hand, b.expiry, p.brand_name
|
||||
FROM batches b
|
||||
JOIN products p ON b.product_id = p.id
|
||||
WHERE b.tenant_id = $1
|
||||
`, [testTenant]);
|
||||
|
||||
console.log('Batches seeded count:', batches.rows.length);
|
||||
batches.rows.forEach(b => console.log(' Batch:', b.batch_no, 'Brand:', b.brand_name, 'Qty:', b.qty_on_hand));
|
||||
|
||||
await pool.end();
|
||||
}
|
||||
|
||||
test().catch(console.error);
|
||||
Reference in New Issue
Block a user