75 lines
2.1 KiB
TypeScript
75 lines
2.1 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();
|
||
|
||
const matchIds = [
|
||
'7cnm7h7qbsq2bbaxngusojh90',
|
||
'7lmrfu2k1e2uxprxfxgaevcb8',
|
||
'3ko3otchy41d28rzxfpvl3d3o'
|
||
];
|
||
|
||
async function getMatches() {
|
||
for (const matchId of matchIds) {
|
||
try {
|
||
const match = await prisma.liveMatch.findUnique({
|
||
where: { id: matchId },
|
||
include: {
|
||
homeTeam: true,
|
||
awayTeam: true,
|
||
league: true,
|
||
},
|
||
});
|
||
|
||
if (!match) {
|
||
console.log(`\n❌ Maç bulunamadı: ${matchId}`);
|
||
continue;
|
||
}
|
||
|
||
console.log(`\n${'='.repeat(80)}`);
|
||
console.log(`📊 MAÇ: ${match.homeTeam?.name} vs ${match.awayTeam?.name}`);
|
||
console.log('='.repeat(80));
|
||
console.log(`ID: ${match.id}`);
|
||
console.log(`Lig: ${match.league?.name}`);
|
||
console.log(`Durum: ${match.state} / ${match.substate}`);
|
||
console.log(`Maç Zamanı (MS): ${match.mstUtc?.toString()}`);
|
||
console.log(`Hakem: ${match.refereeName || 'Bilinmiyor'}`);
|
||
console.log(`İlk 11 Var: ${match.lineups ? '✅' : '❌'}`);
|
||
console.log(`Sakat/Cezalı: ${match.sidelined ? '✅ Var' : '❌ Yok'}`);
|
||
|
||
// Lineups summary
|
||
if (match.lineups) {
|
||
const lineups = match.lineups as any;
|
||
if (lineups.home && lineups.home.xi) {
|
||
console.log(`\n🏠 EV SAHİBİ İLK 11 (${match.homeTeam?.name}):`);
|
||
lineups.home.xi.forEach((p: any) => {
|
||
console.log(` ${p.matchName} (${p.shirtNumber}) - ${p.position}`);
|
||
});
|
||
}
|
||
if (lineups.away && lineups.away.xi) {
|
||
console.log(`\n✈️ DEPLASMAN İLK 11 (${match.awayTeam?.name}):`);
|
||
lineups.away.xi.forEach((p: any) => {
|
||
console.log(` ${p.matchName} (${p.shirtNumber}) - ${p.position}`);
|
||
});
|
||
}
|
||
}
|
||
|
||
console.log('\n');
|
||
|
||
} catch (error) {
|
||
console.error(`❌ Hata (${matchId}):`, error);
|
||
}
|
||
}
|
||
|
||
await prisma.$disconnect();
|
||
}
|
||
|
||
getMatches();
|