Fix jwt-token

This commit is contained in:
2025-09-13 13:13:43 +02:00
parent 04b103fe32
commit 0518f8dd5d
5 changed files with 291 additions and 27 deletions

View File

@@ -1,11 +1,15 @@
const bcrypt = require('bcryptjs');
const { User, Device, AlertRule } = require('./models');
const { User, Device, AlertRule, ManagementUser } = require('./models');
const { createInitialManagementUser } = require('./scripts/seed-management-users');
async function seedDatabase() {
try {
console.log('🌱 Seeding database...');
// Check if admin user exists
// First, create management users (platform admins)
await createInitialManagementUser();
// Check if admin user exists (legacy tenant admin)
const existingAdmin = await User.findOne({ where: { username: 'admin' } });
if (!existingAdmin) {