first commit

This commit is contained in:
2025-11-06 11:08:59 +01:00
commit 3c5117c2c3
85 changed files with 13275 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
const bcrypt = require('bcryptjs');
const { User } = require('../models');
module.exports = {
up: async (queryInterface, Sequelize) => {
try {
// Create admin user
const adminPassword = process.env.ADMIN_PASSWORD || 'admin123';
const saltRounds = 12;
const passwordHash = await bcrypt.hash(adminPassword, saltRounds);
const adminUser = await User.create({
email: 'admin@reasonflow.com',
password_hash: passwordHash,
first_name: 'Admin',
last_name: 'User',
role: 'admin',
is_active: true,
preferences: {
theme: 'light',
notifications: true,
language: 'en'
}
});
console.log('✅ Admin user created:', adminUser.email);
return adminUser;
} catch (error) {
console.error('❌ Error creating admin user:', error);
throw error;
}
},
down: async (queryInterface, Sequelize) => {
try {
await User.destroy({
where: { email: 'admin@reasonflow.com' }
});
console.log('✅ Admin user removed');
} catch (error) {
console.error('❌ Error removing admin user:', error);
throw error;
}
}
};