feat: add core backend modules, inventory services, and patch scripts for AI Pharmacy API
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { pool } from '../src/db/pool';
|
||||
|
||||
async function updateManufacturers() {
|
||||
const mfrs = [
|
||||
'Cipla Ltd',
|
||||
'Sun Pharma',
|
||||
"Dr. Reddy's Laboratories",
|
||||
'Lupin Ltd',
|
||||
'Abbott Healthcare',
|
||||
'Mankind Pharma',
|
||||
'Alkem Laboratories',
|
||||
'Torrent Pharma',
|
||||
'Zydus Healthcare',
|
||||
'GlaxoSmithKline'
|
||||
];
|
||||
|
||||
const res = await pool.query('SELECT id FROM products');
|
||||
console.log('Total products in DB:', res.rows.length);
|
||||
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
const mfr = mfrs[i % mfrs.length];
|
||||
await pool.query('UPDATE products SET manufacturer = $1 WHERE id = $2', [mfr, res.rows[i].id]);
|
||||
}
|
||||
|
||||
console.log('Successfully updated manufacturer for all products in database!');
|
||||
await pool.end();
|
||||
}
|
||||
|
||||
updateManufacturers().catch(console.error);
|
||||
Reference in New Issue
Block a user