This commit is contained in:
2026-04-16 17:21:48 +03:00
parent c8fa4c442d
commit c8e7e4e927
116 changed files with 3720 additions and 4197 deletions
+20 -20
View File
@@ -5,29 +5,29 @@
* Kullanım: npx ts-node -r tsconfig-paths/register src/scripts/cleanup-live-matches.ts
*/
import { PrismaClient } from '@prisma/client';
import { PrismaClient } from "@prisma/client";
const FINISHED_STATUSES = ['Finished', 'Played', 'FT', 'AET', 'PEN', 'Ended'];
const FINISHED_STATES = ['Finished', 'post', 'FT', 'postGame'];
const FINISHED_STATUSES = ["Finished", "Played", "FT", "AET", "PEN", "Ended"];
const FINISHED_STATES = ["Finished", "post", "FT", "postGame"];
const LIVE_STATUSES = [
'LIVE',
'1H',
'2H',
'HT',
'1Q',
'2Q',
'3Q',
'4Q',
'Playing',
'Half Time',
"LIVE",
"1H",
"2H",
"HT",
"1Q",
"2Q",
"3Q",
"4Q",
"Playing",
"Half Time",
];
const LIVE_STATES = ['live', 'firsthalf', 'secondhalf'];
const LIVE_STATES = ["live", "firsthalf", "secondhalf"];
async function cleanupLiveMatches() {
const prisma = new PrismaClient();
try {
console.log('🧹 Live matches temizliği başlıyor...');
console.log("🧹 Live matches temizliği başlıyor...");
const now = Date.now();
const finishedGraceMs = 6 * 60 * 60 * 1000;
@@ -51,7 +51,7 @@ async function cleanupLiveMatches() {
},
});
console.log('📊 Mevcut durum:');
console.log("📊 Mevcut durum:");
console.log(` Toplam live_matches: ${totalBefore}`);
console.log(` Geçmiş zamanlı kayıt: ${outdatedCount}`);
console.log(
@@ -83,7 +83,7 @@ async function cleanupLiveMatches() {
const totalAfter = await prisma.liveMatch.count();
console.log('\n✅ Temizlik tamamlandı!');
console.log("\n✅ Temizlik tamamlandı!");
console.log(` Silinen maç: ${deleted.count}`);
console.log(` Kalan maç: ${totalAfter}`);
@@ -93,12 +93,12 @@ async function cleanupLiveMatches() {
GROUP BY state
`;
console.log('\n📋 Kalan maçların durumları:');
console.log("\n📋 Kalan maçların durumları:");
(states as any).forEach((s: any) => {
console.log(` ${s.state || 'null'}: ${s.count}`);
console.log(` ${s.state || "null"}: ${s.count}`);
});
} catch (error) {
console.error('❌ Hata:', error);
console.error("❌ Hata:", error);
} finally {
await prisma.$disconnect();
}