diff --git a/api/routes/auth.js b/api/routes/auth.js index 0bb0c1d..5272cc2 100644 --- a/api/routes/auth.js +++ b/api/routes/auth.js @@ -25,7 +25,7 @@ router.post('/register', async (req, res) => { const countQuery = await pgPool.query('SELECT COUNT(*) FROM users'); const userCount = parseInt(countQuery.rows[0].count, 10); - const assignedRole = userCount === 0 ? 'admin' : 'free_trial'; + const assignedRole = userCount === 0 ? 'enterprise' : 'free_trial'; const salt = await bcrypt.genSalt(10); const hash = await bcrypt.hash(password, salt); diff --git a/api/server.js b/api/server.js index c86beb0..886b0b3 100644 --- a/api/server.js +++ b/api/server.js @@ -52,8 +52,10 @@ const initDb = async () => { await pgPool.query(sql); console.log('Database initialized successfully.'); - // Force promote the owner to admin - await pgPool.query("UPDATE users SET role = 'admin' WHERE email = 'mohan.k@cavininfotech.com'"); + // Force promote the owner to admin (enterprise role) + await pgPool.query("UPDATE users SET role = 'enterprise' WHERE email = 'mohan.k@cavininfotech.com'"); + await pgPool.query("UPDATE users SET role = 'enterprise' WHERE email = 'admin@cavininfotech.com'"); + await pgPool.query("UPDATE users SET role = 'enterprise' WHERE role = 'admin'"); } catch (err) { console.error('Database initialization failed:', err); }