Dealer_Onboarding_Backend/check_logs.ts

22 lines
616 B
TypeScript

import db from './src/database/models/index.js';
async function checkAuditLogs() {
try {
const resignationLogs = await db.ResignationAudit.findAll({
include: [{ model: db.User, as: 'user', attributes: ['fullName'] }],
limit: 5,
order: [['createdAt', 'DESC']]
});
console.log('--- RECENT RESIGNATION AUDIT LOGS ---');
console.log(JSON.stringify(resignationLogs, null, 2));
process.exit(0);
} catch (error) {
console.error('Error checking logs:', error);
process.exit(1);
}
}
checkAuditLogs();