44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import db from '../src/database/models/index.js';
|
|
import { resolveEntityUuidByType } from '../src/common/utils/requestResolver.js';
|
|
|
|
async function run() {
|
|
const id = 'FNF-2026-614';
|
|
console.log(`Resolving ID: ${id}`);
|
|
|
|
try {
|
|
const { resolvedId, normalizedType } = await resolveEntityUuidByType(db as any, id, 'fnf');
|
|
console.log(`Resolved ID: ${resolvedId}, Type: ${normalizedType}`);
|
|
|
|
if (resolvedId !== id) {
|
|
console.log('Lookup successful!');
|
|
|
|
const fnf = await db.FnF.findByPk(resolvedId, {
|
|
include: [
|
|
{
|
|
model: db.RequestParticipant,
|
|
as: 'participants',
|
|
include: [{ model: db.User, as: 'user', attributes: ['fullName'] }]
|
|
}
|
|
]
|
|
});
|
|
|
|
if (fnf && fnf.participants) {
|
|
console.log(`Found ${fnf.participants.length} participants for ${id}`);
|
|
fnf.participants.forEach((p: any) => {
|
|
console.log(`- ${p.user?.fullName}`);
|
|
});
|
|
} else {
|
|
console.log('No participants found in the Eager Load.');
|
|
}
|
|
} else {
|
|
console.log('Lookup failed to find a different UUID.');
|
|
}
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
process.exit();
|
|
}
|
|
}
|
|
|
|
run();
|