33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { ParticipantService } from './src/services/ParticipantService.js';
|
|
|
|
async function run() {
|
|
try {
|
|
const requestId = '29b742a7-6d9f-4736-8aae-295ffe32ef75';
|
|
console.log(`Fixing participants for resignation ${requestId}...`);
|
|
|
|
const { Resignation, User, Dealer, Application, District } = (await import('./src/database/models/index.js')).default;
|
|
const resignation = await Resignation.findByPk(requestId);
|
|
console.log('Resignation Record:', JSON.stringify(resignation, null, 2));
|
|
|
|
if (resignation) {
|
|
const user = await User.findByPk(resignation.dealerId);
|
|
console.log('User Record:', JSON.stringify(user, null, 2));
|
|
if (user && user.dealerId) {
|
|
const dealer = await Dealer.findByPk(user.dealerId, {
|
|
include: [{ model: Application, as: 'application', include: [{ model: District, as: 'district' }] }]
|
|
});
|
|
console.log('Dealer/Application/District Record:', JSON.stringify(dealer, null, 2));
|
|
}
|
|
}
|
|
|
|
await ParticipantService.assignResignationParticipants(requestId);
|
|
console.log('Done.');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('Error fixing participants:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
run();
|