40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import 'dotenv/config';
|
|
import db from '../src/database/models/index.js';
|
|
const { Role } = db;
|
|
|
|
async function addArchitectureRole() {
|
|
console.log('Adding Architecture Role...');
|
|
try {
|
|
await db.sequelize.authenticate();
|
|
|
|
await Role.findOrCreate({
|
|
where: { roleCode: 'ARCHITECTURE' },
|
|
defaults: {
|
|
roleCode: 'ARCHITECTURE',
|
|
roleName: 'Architecture',
|
|
category: 'DEPARTMENT',
|
|
isActive: true
|
|
}
|
|
});
|
|
|
|
// Also add the 'Architecture' alias if needed for frontend mapping
|
|
await Role.findOrCreate({
|
|
where: { roleCode: 'Architecture' },
|
|
defaults: {
|
|
roleCode: 'Architecture',
|
|
roleName: 'Architecture Team',
|
|
category: 'DEPARTMENT',
|
|
isActive: true
|
|
}
|
|
});
|
|
|
|
console.log('✅ Architecture role added successfully!');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Failed to add role:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
addArchitectureRole();
|