Files
iddaai-be/query-3-matches.ts
T
fahricansecer 7814e0bc6b
Deploy Iddaai Backend / build-and-deploy (push) Failing after 4s
first (part 1: root files)
2026-04-16 15:09:10 +03:00

75 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();