24 lines
716 B
TypeScript
24 lines
716 B
TypeScript
import 'dotenv/config';
|
|
import db from './src/database/models/index.js';
|
|
|
|
async function run() {
|
|
try {
|
|
const participants = await db.RequestParticipant.findAll({
|
|
limit: 100,
|
|
include: [{ model: db.User, as: 'user', attributes: ['fullName', 'roleCode', 'email'] }]
|
|
});
|
|
|
|
console.log(`Found ${participants.length} participants in total:`);
|
|
participants.forEach((p: any) => {
|
|
console.log(`- RequestId: ${p.requestId}, Type: ${p.requestType}, User: ${p.user.fullName}`);
|
|
});
|
|
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('Error querying participants:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
run();
|