diff --git a/frontend-source.tar.gz b/frontend-source.tar.gz new file mode 100644 index 0000000..8208f53 Binary files /dev/null and b/frontend-source.tar.gz differ diff --git a/frontend/src/app/dashboard/seeder/page.tsx b/frontend/src/app/dashboard/seeder/page.tsx index 7b2d033..8eac5cc 100644 --- a/frontend/src/app/dashboard/seeder/page.tsx +++ b/frontend/src/app/dashboard/seeder/page.tsx @@ -27,6 +27,8 @@ export default function SeederPage() { const [processStatus, setProcessStatus] = useState<'idle' | 'running' | 'success' | 'error'>('idle'); const scrollEndRef = useRef(null); + const [showConfirmDialog, setShowConfirmDialog] = useState(false); + // Auto-scroll to bottom of logs useEffect(() => { if (scrollEndRef.current) { @@ -54,7 +56,11 @@ export default function SeederPage() { if (type === 'reset') { // Legacy Reset (POST) - Mimic stream output setLogs(['🚀 Starting flush/reset process...']); - const res = await fetch(`${getSeederApiUrl()}/reset`, { method: 'POST' }); + const res = await fetch(`${getSeederApiUrl()}/reset`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, // Fix for Express parsing empty body if needed + body: JSON.stringify({}) // Explicit empty body + }); const data = await res.json(); if (res.ok) { setLogs(prev => [...prev, '✅ Reset completed successfully!', JSON.stringify(data, null, 2)]); @@ -196,9 +202,7 @@ export default function SeederPage() { + + + + ); } diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 0349e0f..7fd4cb2 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -8,6 +8,7 @@ "backoffice": "Backoffice", "messages": "Messages", "tickets": "Tickets", + "settings": "Settings", "my_jobs": "My Jobs", "applications": "Applications", "my_applications": "My Applications", diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json index 9049cb3..a3f3e80 100644 --- a/frontend/src/i18n/pt-BR.json +++ b/frontend/src/i18n/pt-BR.json @@ -8,6 +8,7 @@ "backoffice": "Backoffice", "messages": "Mensagens", "tickets": "Tickets", + "settings": "Configurações", "my_jobs": "Minhas Vagas", "applications": "Candidaturas", "my_applications": "Minhas Candidaturas", diff --git a/frontend/src/lib/auth.ts b/frontend/src/lib/auth.ts index 0e2a1af..f9c7bc8 100644 --- a/frontend/src/lib/auth.ts +++ b/frontend/src/lib/auth.ts @@ -122,6 +122,11 @@ function mapRoleFromBackend(roles: string[]): "candidate" | "admin" | "company" */ export async function refreshSession(): Promise { try { + // Ensure runtime config is loaded before making the request + if (typeof window !== "undefined") { + await import("./config").then((m) => m.initConfig()); + } + console.log("%c[AUTH] Attempting to refresh session...", "color: #3b82f6"); const res = await fetch(`${getApiV1Url()}/users/me`, { method: "GET", diff --git a/seeder-api/src/index.js b/seeder-api/src/index.js index 4807e1d..25c5329 100644 --- a/seeder-api/src/index.js +++ b/seeder-api/src/index.js @@ -127,6 +127,7 @@ async function seedDatabase() { // Lite version (skips cities for faster seeding) async function seedDatabaseLite() { console.log('🌱 Starting database seeding (LITE - no cities)...\n'); + console.log('🔍 Debug: seedDatabaseLite started'); console.log('🌶️ PASSWORD_PEPPER:', process.env.PASSWORD_PEPPER ? `"${process.env.PASSWORD_PEPPER}"` : '(not set)'); try { @@ -138,9 +139,13 @@ async function seedDatabaseLite() { console.log(''); // Seed in order (respecting foreign key dependencies) + console.log('🔍 Debug: seeding location data (lite)...'); await seedLocationDataLite(); // ⚡ Fast mode - no cities + console.log('🔍 Debug: seeding companies...'); await seedCompanies(); + console.log('🔍 Debug: seeding users...'); await seedUsers(); + console.log('🔍 Debug: seeding jobs...'); await seedJobs(); await seedAcmeCorp(); await seedWileECoyote(); @@ -152,13 +157,13 @@ async function seedDatabaseLite() { await seedTags(); console.log('\n✅ Database seeding (LITE) completed successfully!'); + console.log('🔍 Debug: seedDatabaseLite finished normally'); console.log(' ⚡ Cities skipped for faster seeding'); } catch (error) { console.error('\n❌ Seeding failed:', error.message); console.error(error); - } finally { - await closePool(); + throw error; } } @@ -194,8 +199,7 @@ async function seedDatabaseNoLocations() { } catch (error) { console.error('\n❌ Seeding failed:', error.message); console.error(error); - } finally { - await closePool(); + throw error; } } @@ -233,4 +237,3 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) { } })(); } - diff --git a/seeder-api/src/server.js b/seeder-api/src/server.js index 129668c..97f9ef9 100644 --- a/seeder-api/src/server.js +++ b/seeder-api/src/server.js @@ -149,7 +149,7 @@ app.post('/reset', async (req, res) => { return res.status(409).json({ error: 'Seeding/Reset in progress' }); } - const password = req.body.password; + const password = req.body?.password; if (process.env.SEED_PASSWORD && password !== process.env.SEED_PASSWORD) { return res.status(401).json({ error: 'Unauthorized' }); }