Files
cannaiq/backend/add-test-brands.ts
2025-11-28 19:45:44 -07:00

91 lines
3.8 KiB
TypeScript

import { Pool } from 'pg';
const pool = new Pool({
connectionString: 'postgresql://sail:password@localhost:5432/dutchie_menus'
});
async function addTestBrands() {
try {
// Update the store slug to match the local URL
console.log('Updating store slug...');
await pool.query(
`UPDATE stores
SET slug = $1,
dutchie_url = $2,
updated_at = NOW()
WHERE slug = $3`,
[
'curaleaf-az-48th-street',
'https://curaleaf.com/stores/curaleaf-dispensary-48th-street',
'curaleaf-az-48th-street-med'
]
);
console.log('✓ Store slug updated\n');
// Get the store ID
const storeResult = await pool.query(
'SELECT id FROM stores WHERE slug = $1',
['curaleaf-az-48th-street']
);
if (storeResult.rows.length === 0) {
console.log('Store not found!');
return;
}
const storeId = storeResult.rows[0].id;
// Sample products with brands commonly found at dispensaries
const testProducts = [
{ name: 'Select Elite Live Resin Cartridge - Clementine', brand: 'Select', price: 45.00, category: 'vape-pens', thc: 82.5 },
{ name: 'Curaleaf Flower - Blue Dream', brand: 'Curaleaf', price: 35.00, category: 'flower', thc: 22.0 },
{ name: 'Grassroots RSO Syringe', brand: 'Grassroots', price: 40.00, category: 'concentrates', thc: 75.0 },
{ name: 'Stiiizy Pod - Skywalker OG', brand: 'Stiiizy', price: 50.00, category: 'vape-pens', thc: 85.0 },
{ name: 'Cookies Flower - Gary Payton', brand: 'Cookies', price: 55.00, category: 'flower', thc: 28.0 },
{ name: 'Raw Garden Live Resin - Wedding Cake', brand: 'Raw Garden', price: 48.00, category: 'concentrates', thc: 80.5 },
{ name: 'Jeeter Pre-Roll - Zkittlez', brand: 'Jeeter', price: 12.00, category: 'pre-rolls', thc: 24.0 },
{ name: 'Kiva Camino Gummies - Wild Cherry', brand: 'Kiva', price: 20.00, category: 'edibles', thc: 5.0 },
{ name: 'Wyld Gummies - Raspberry', brand: 'Wyld', price: 18.00, category: 'edibles', thc: 10.0 },
{ name: 'Papa & Barkley Releaf Balm', brand: 'Papa & Barkley', price: 45.00, category: 'topicals', thc: 3.0 },
{ name: 'Brass Knuckles Cartridge - Gorilla Glue', brand: 'Brass Knuckles', price: 42.00, category: 'vape-pens', thc: 83.0 },
{ name: 'Heavy Hitters Ultra Extract - Sour Diesel', brand: 'Heavy Hitters', price: 55.00, category: 'concentrates', thc: 90.0 },
{ name: 'Cresco Liquid Live Resin - Pineapple Express', brand: 'Cresco', price: 50.00, category: 'vape-pens', thc: 87.0 },
{ name: 'Verano Pre-Roll - Mag Landrace', brand: 'Verano', price: 15.00, category: 'pre-rolls', thc: 26.0 },
{ name: 'Select Nano Gummies - Watermelon', brand: 'Select', price: 22.00, category: 'edibles', thc: 10.0 }
];
console.log(`Inserting ${testProducts.length} test products with brands...`);
console.log('─'.repeat(80));
for (const product of testProducts) {
await pool.query(
`INSERT INTO products (
store_id, name, brand, price, thc_percentage,
dutchie_url, in_stock
)
VALUES ($1, $2, $3, $4, $5, $6, true)`,
[
storeId,
product.name,
product.brand,
product.price,
product.thc,
`https://curaleaf.com/stores/curaleaf-dispensary-48th-street/product/${product.name.toLowerCase().replace(/\s+/g, '-')}`
]
);
console.log(`${product.brand} - ${product.name}`);
}
console.log('─'.repeat(80));
console.log(`\n✅ Added ${testProducts.length} test products with brands to the store\n`);
console.log(`View at: http://localhost:5174/stores/az/curaleaf/curaleaf-az-48th-street\n`);
} catch (error: any) {
console.error('Error:', error.message);
} finally {
await pool.end();
}
}
addTestBrands();