- Add backend stale process monitoring API (/api/stale-processes) - Add users management route - Add frontend landing page and stale process monitor UI on /scraper-tools - Move old development scripts to backend/archive/ - Update frontend build with new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
831 B
TypeScript
34 lines
831 B
TypeScript
import pkg from 'pg';
|
|
const { Pool } = pkg;
|
|
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL
|
|
});
|
|
|
|
async function main() {
|
|
const result = await pool.query(`
|
|
SELECT
|
|
COUNT(*) as total_products,
|
|
COUNT(CASE WHEN discount_type IS NOT NULL AND discount_value IS NOT NULL THEN 1 END) as products_with_discounts
|
|
FROM products
|
|
`);
|
|
|
|
console.log('Product Count:');
|
|
console.log(result.rows[0]);
|
|
|
|
// Get a sample of products with discounts
|
|
const sample = await pool.query(`
|
|
SELECT name, brand, regular_price, sale_price, discount_type, discount_value
|
|
FROM products
|
|
WHERE discount_type IS NOT NULL AND discount_value IS NOT NULL
|
|
LIMIT 5
|
|
`);
|
|
|
|
console.log('\nSample Products with Discounts:');
|
|
console.log(sample.rows);
|
|
|
|
await pool.end();
|
|
}
|
|
|
|
main().catch(console.error);
|