import { pool } from './src/db/migrate.js'; async function main() { const result = await pool.query(` SELECT name, brand, regular_price, sale_price, in_stock, stock_status FROM products WHERE dispensary_id = 112 AND brand = 'Select' ORDER BY name LIMIT 10 `); console.log('\n' + '='.repeat(100)); console.log('SELECT BRAND PRODUCTS WITH PRICES (NEW ONE-PASS APPROACH)'); console.log('='.repeat(100) + '\n'); result.rows.forEach((row, idx) => { const regularPrice = row.regular_price ? `$${parseFloat(row.regular_price).toFixed(2)}` : 'N/A'; const salePrice = row.sale_price ? `$${parseFloat(row.sale_price).toFixed(2)}` : 'N/A'; const stock = row.in_stock ? (row.stock_status || 'In Stock') : 'Out of Stock'; console.log(`${idx + 1}. ${row.name}`); console.log(` Price: ${regularPrice} | Sale: ${salePrice} | Stock: ${stock}`); console.log(''); }); console.log('='.repeat(100) + '\n'); await pool.end(); } main().catch(console.error);