Fix jwt-token

This commit is contained in:
2025-09-20 23:09:39 +02:00
parent 60748b354f
commit 4df5a628de

View File

@@ -1,4 +1,10 @@
const { Sequelize } = require('sequelize');
const { Sequelize } = re // Models are already initialized through the imports
console.log('📋 Models loaded and ready...');
// For fresh database, just sync to create tables first
console.log('🏗️ Creating database tables...');
await sequelize.sync({ force: true }); // WARNING: This will drop existing tables
console.log('✅ Database tables created successfully.\n');sequelize');
const bcrypt = require('bcryptjs');
// Import models from the main models index
@@ -38,7 +44,7 @@ const setupDatabase = async () => {
const adminUser = await User.create({
username: 'admin',
email: 'admin@example.com',
password: await bcrypt.hash('admin123', 10),
password_hash: await bcrypt.hash('admin123', 10),
role: 'admin'
});
console.log(`✅ Admin user created: ${adminUser.username}`);
@@ -48,7 +54,7 @@ const setupDatabase = async () => {
const operatorUser = await User.create({
username: 'operator',
email: 'operator@example.com',
password: await bcrypt.hash('operator123', 10),
password_hash: await bcrypt.hash('operator123', 10),
role: 'operator'
});
console.log(`✅ Operator user created: ${operatorUser.username}`);