import { sequelize } from './src/config/database'; import { User } from './src/models/User'; async function makeAdmin() { try { const email = 'testuser11@eichergroup.com'; console.log(`Setting role to ADMIN for: ${email}`); // Test connection first await sequelize.authenticate(); console.log('Database connected.'); const [updatedRows] = await User.update( { role: 'ADMIN' }, { where: { email: email } } ); if (updatedRows > 0) { console.log(`✅ Success! ${email} is now an ADMIN.`); } else { console.log(`⚠️ User not found in database: ${email}`); console.log(`Creating user ${email} with ADMIN role...`); const newUser = await User.create({ email: email, oktaSub: `MANUAL_ADMIN_${Date.now()}`, firstName: 'Test', lastName: 'User 11', displayName: 'Test User 11', role: 'ADMIN', isActive: true }); console.log(`✅ Success! Created new ADMIN user: ${newUser.email}`); } } catch (error) { console.error('❌ Error updating user:', error); } finally { await sequelize.close(); } } makeAdmin();