64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
import * as dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
// BigInt serialization fix
|
|
(BigInt.prototype as any).toJSON = function () {
|
|
return this.toString();
|
|
};
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function getMatches() {
|
|
const matches = await prisma.liveMatch.findMany({
|
|
where: {
|
|
id: {
|
|
in: [
|
|
'7cnm7h7qbsq2bbaxngusojh90',
|
|
'7lmrfu2k1e2uxprxfxgaevcb8',
|
|
'3ko3otchy41d28rzxfpvl3d3o'
|
|
]
|
|
}
|
|
},
|
|
include: {
|
|
homeTeam: true,
|
|
awayTeam: true,
|
|
league: true,
|
|
},
|
|
});
|
|
|
|
matches.forEach((match, idx) => {
|
|
console.log(`\n${'='.repeat(80)}`);
|
|
console.log(`MAÇ ${idx + 1}: ${match.homeTeam?.name} vs ${match.awayTeam?.name}`);
|
|
console.log('='.repeat(80));
|
|
console.log(`ID: ${match.id}`);
|
|
console.log(`Lig: ${match.league?.name} (${match.league?.countryId})`);
|
|
console.log(`Durum: ${match.state} / ${match.substate}`);
|
|
console.log(`Skor: ${match.scoreHome ?? '?'} - ${match.scoreAway ?? '?'}`);
|
|
console.log(`Hakem: ${match.refereeName || 'Bilinmiyor'}`);
|
|
console.log(`Lineups Tip: ${typeof match.lineups} | ${match.lineups ? 'VAR' : 'YOK'}`);
|
|
|
|
if (match.lineups) {
|
|
const lineups = match.lineups as any;
|
|
console.log(`Lineups Keys: ${Object.keys(lineups).join(', ')}`);
|
|
|
|
// Check structure
|
|
if (lineups.home) {
|
|
const homeXi = lineups.home.xi || lineups.home.stats || [];
|
|
console.log(`Ev Sahibi İlk 11: ${Array.isArray(homeXi) ? homeXi.length : 'N/A'} oyuncu`);
|
|
}
|
|
if (lineups.away) {
|
|
const awayXi = lineups.away.xi || lineups.away.stats || [];
|
|
console.log(`Deplasman İlk 11: ${Array.isArray(awayXi) ? awayXi.length : 'N/A'} oyuncu`);
|
|
}
|
|
}
|
|
|
|
console.log('');
|
|
});
|
|
|
|
await prisma.$disconnect();
|
|
}
|
|
|
|
getMatches();
|