import db from './src/database/models/index.js'; import { WorkflowService } from './src/services/WorkflowService.js'; import { APPLICATION_STATUS } from './src/common/config/constants.js'; async function heal() { try { const applicationId = 'a8d0ffb3-be90-4aa8-9344-16729ed07056'; const application = await db.Application.findByPk(applicationId); console.log(`Healing application ${application.applicationId}...`); const request = await db.LoaRequest.findOne({ where: { applicationId: application.id } }); if (request) { await request.update({ status: 'Approved', approvedAt: new Date() }); } await WorkflowService.transitionApplication(application, APPLICATION_STATUS.EOR_IN_PROGRESS, '18122cf4-d905-484c-a9ff-7b6229f101ef', { reason: 'Manually recovered: Policy met with 3 approvals.', progressPercentage: 97 }); console.log('Done.'); process.exit(0); } catch (e) { console.error(e); process.exit(1); } } heal();