QR-master/scripts/verify-lead-db.ts

35 lines
1.0 KiB
TypeScript

import { db } from '../src/lib/db';
async function main() {
try {
console.log('Verifying Lead model...');
// Type assertion to bypass potential type generation issues locally if they exist
const leadCount = await (db as any).lead.count();
console.log(`Current lead count: ${leadCount}`);
const testLead = await (db as any).lead.create({
data: {
email: 'test_verify@example.com',
source: 'verification-script',
reprintCost: 100,
updatesPerYear: 12,
annualSavings: 1200,
},
});
console.log('Successfully created test lead:', testLead.id);
// Clean up
await (db as any).lead.delete({
where: { id: testLead.id }
});
console.log('Successfully deleted test lead');
} catch (error) {
console.error('Verification failed:', error);
process.exit(1);
}
}
main();