"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const client_1 = require("@prisma/client"); const prisma = new client_1.PrismaClient(); async function main() { try { const testSource = await prisma.source.upsert({ where: { name: 'Test Source', }, update: { url: 'http://example.com', }, create: { name: 'Test Source', url: 'http://example.com', }, }); console.log('Test source created/updated successfully:', testSource); const products = await Promise.all([ prisma.product.create({ data: { name: 'iPhone 15', description: 'Latest Apple smartphone', category: 'Electronics', sourceId: testSource.id, prices: { create: { regularPrice: 999.99, discountedPrice: 899.99, discountPercentage: 10, sourceId: testSource.id, unitPrice: '$999.99/unit' } } }, }), prisma.product.create({ data: { name: 'Samsung Galaxy S24', description: 'Premium Android smartphone', category: 'Electronics', sourceId: testSource.id, prices: { create: { regularPrice: 899.99, sourceId: testSource.id, unitPrice: '$899.99/unit' } } }, }), prisma.product.create({ data: { name: 'Sony PlayStation 5', description: 'Gaming console with advanced graphics', category: 'Gaming', sourceId: testSource.id, prices: { create: { regularPrice: 499.99, sourceId: testSource.id, unitPrice: '$499.99/unit' } } }, }), ]); console.log('Sample products created successfully:', products); } catch (error) { console.error('Error creating test data:', error); } finally { await prisma.$disconnect(); } } main(); //# sourceMappingURL=test-db.js.map