Files
AI_Pharmacy_Api/check_db.js
T

20 lines
576 B
JavaScript

const { pool } = require('./src/db/pool');
(async () => {
try {
const rx = await pool.query(
'SELECT id, tenant_id, status, created_at, extracted_data FROM prescriptions ORDER BY created_at DESC'
);
console.log('Prescriptions:', JSON.stringify(rx.rows, null, 2));
const users = await pool.query(
'SELECT id, username, role, pharmacy_name, tenant_id FROM users'
);
console.log('Users:', JSON.stringify(users.rows, null, 2));
} catch (err) {
console.error('Error executing query:', err);
} finally {
process.exit();
}
})();