Backend: - Fix migrations 037-041 to use UUID v7 (uuid_generate_v7) - Fix CORS defaults to include localhost:8963 - Fix FRONTEND_URL default to localhost:8963 - Update superadmin password hash with pepper - Add PASSWORD_PEPPER environment variable Frontend: - Replace mockJobs with real API calls in home page - Replace mockNotifications with notificationsApi in context - Replace mockApplications with applicationsApi in dashboard - Fix register/user page to call real registerCandidate API - Fix hardcoded values in backoffice and messages pages Auth: - Support both HTTPOnly cookie and Bearer token authentication - Login returns token + sets HTTPOnly cookie - Logout clears HTTPOnly cookie - Token valid for 24h
43 lines
1.4 KiB
SQL
43 lines
1.4 KiB
SQL
-- Migration: Create Super Admin and System Company
|
|
-- Description: Inserts the default System Company and Super Admin user.
|
|
-- Uses unified tables (companies, users, user_roles)
|
|
-- HARDCODED: This is the official superadmin - password: Admin@2025! (with pepper: gohorse-pepper)
|
|
|
|
-- 1. Insert System Company (for SuperAdmin context)
|
|
INSERT INTO companies (name, slug, type, document, email, description, verified, active)
|
|
VALUES (
|
|
'GoHorse System',
|
|
'gohorse-system',
|
|
'system',
|
|
'00.000.000/0001-91',
|
|
'admin@gohorsejobs.com',
|
|
'{"tagline": "System Administration Tenant"}',
|
|
true,
|
|
true
|
|
) ON CONFLICT (slug) DO NOTHING;
|
|
|
|
-- 2. Insert Super Admin User
|
|
-- Hash: bcrypt(Admin@2025! + gohorse-pepper)
|
|
INSERT INTO users (identifier, password_hash, role, full_name, email, status, active)
|
|
VALUES (
|
|
'superadmin',
|
|
'$2a$10$LtQroKXfdtgp7B9eO81bAuMY8BTpc5sRu76J0gFttCKZYDTFfMNA.',
|
|
'superadmin',
|
|
'Super Administrator',
|
|
'admin@gohorsejobs.com',
|
|
'ACTIVE',
|
|
true
|
|
) ON CONFLICT (identifier) DO UPDATE SET
|
|
password_hash = EXCLUDED.password_hash,
|
|
status = 'ACTIVE';
|
|
|
|
-- 3. Assign superadmin role (if user_roles table exists)
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (SELECT FROM pg_tables WHERE tablename = 'user_roles') THEN
|
|
INSERT INTO user_roles (user_id, role)
|
|
SELECT id, 'superadmin' FROM users WHERE identifier = 'superadmin'
|
|
ON CONFLICT (user_id, role) DO NOTHING;
|
|
END IF;
|
|
END $$;
|
|
|