Dealer_Onboarding_Backend/repair_all_progress.ts

19 lines
695 B
TypeScript

import db from './src/database/models/index.js';
import { syncApplicationProgress } from './src/common/utils/progress.js';
async function repairAllProgress() {
console.log('--- Repairing Progress Tracker State for ALL Applications ---');
const apps = await db.Application.findAll();
console.log(`Found ${apps.length} applications to sync.`);
for (const app of apps) {
console.log(`Syncing Progress for Application: ${app.applicationId} (Status: ${app.overallStatus})`);
await syncApplicationProgress(app.id, app.overallStatus);
}
console.log('--- REPAIR COMPLETE ---');
}
repairAllProgress().catch(console.error).then(() => process.exit(0));