- 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>
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { pool } from './src/db/migrate.js';
|
|
|
|
async function main() {
|
|
try {
|
|
// Count total products and unique brands
|
|
const stats = await pool.query(`
|
|
SELECT
|
|
COUNT(*) as total_products,
|
|
COUNT(DISTINCT brand) as unique_brands
|
|
FROM products
|
|
WHERE dispensary_id = 149
|
|
`);
|
|
|
|
console.log('Stats:', stats.rows[0]);
|
|
|
|
// Get sample products to verify brand extraction
|
|
const samples = await pool.query(`
|
|
SELECT brand, name, variant, dutchie_url
|
|
FROM products
|
|
WHERE dispensary_id = 149
|
|
ORDER BY RANDOM()
|
|
LIMIT 10
|
|
`);
|
|
|
|
console.log('\nSample products:');
|
|
samples.rows.forEach(row => {
|
|
console.log(`Brand: "${row.brand}" | Name: "${row.name}" | Variant: "${row.variant}"`);
|
|
});
|
|
|
|
// Get brand distribution
|
|
const brands = await pool.query(`
|
|
SELECT brand, COUNT(*) as count
|
|
FROM products
|
|
WHERE dispensary_id = 149
|
|
GROUP BY brand
|
|
ORDER BY count DESC
|
|
LIMIT 15
|
|
`);
|
|
|
|
console.log('\nTop brands:');
|
|
brands.rows.forEach(row => {
|
|
console.log(`${row.brand}: ${row.count} products`);
|
|
});
|
|
|
|
} catch (error: any) {
|
|
console.error('Error:', error.message);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|
|
|
|
main().catch(console.error);
|