import db from '../src/database/models/index.js'; const seedSystemConfigs = async () => { try { console.log('Seeding system configurations...'); const configs = [ { key: 'INITIAL_SECURITY_DEPOSIT', value: { amount: 500000, currency: 'INR' }, category: 'SECURITY_DEPOSIT', description: 'Default Initial Security Deposit amount for new dealer onboarding' }, { key: 'FINAL_SECURITY_DEPOSIT', value: { amount: 1500000, currency: 'INR' }, category: 'SECURITY_DEPOSIT', description: 'Default Final Security Deposit amount for new dealer onboarding' } ]; for (const config of configs) { await db.SystemConfiguration.findOrCreate({ where: { key: config.key }, defaults: { ...config, isActive: true } }); } console.log('System configurations seeded successfully.'); } catch (error) { console.error('Error seeding system configurations:', error); } finally { // Only close if this is the main module // db.sequelize.close(); } }; // Run if called directly if (import.meta.url === `file://${process.argv[1]}`) { seedSystemConfigs().then(() => process.exit(0)); } export default seedSystemConfigs;