import db from './src/database/models/index.js'; const { Application, ApplicationStatusHistory } = db; async function checkApp() { try { const app = await Application.findOne({ order: [['updatedAt', 'DESC']] }); if (!app) { console.log('No apps found'); return; } console.log('--- Application Info ---'); console.log(`ID: ${app.id}, Reg: ${app.applicationId}, Name: ${app.applicantName}`); console.log(`Current Status: ${app.overallStatus}, Progress: ${app.progressPercentage}`); const history = await ApplicationStatusHistory.findAll({ where: { applicationId: app.id }, order: [['createdAt', 'ASC']] }); console.log('\n--- Status History ---'); history.forEach((h: any) => { console.log(`[${h.createdAt.toISOString()}] ${h.previousStatus} -> ${h.newStatus} (Reason: ${h.reason})`); }); } catch (err) { console.error(err); } finally { process.exit(0); } } checkApp();