import fs from "fs"; import path from "path"; import { fileURLToPath } from "url"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); // Read the game descriptions JSON const gamesPath = "/home/ubuntu/upload/casino-slots-aggregation-app-main/archive/casinodog-slim/game_descriptions.json"; const gamesData = JSON.parse(fs.readFileSync(gamesPath, "utf-8")); console.log(`Total games found: ${gamesData.length}`); // Transform games to our schema const transformedGames = gamesData.map((game, index) => { const [provider, gameId] = game.identifier.split("/"); return { gameId: game.identifier, gameName: gameId || game.identifier, gameType: "slot", category: game.category || "slots", provider: provider || "unknown", rtp: parseFloat(game.payout) || 0.96, volatility: game.volatility_rating || "medium", paylines: game.lines || 0, reels: 5, minBet: 0.01, maxBet: 100, jackpot: false, hasIcon: false, iconUrl: null, isActive: true, isFeatured: index < 50, // Feature first 50 games playCount: 0, totalWinnings: 0, averageWin: 0, description: game.description || "", createdAt: new Date(), updatedAt: new Date(), }; }); // Save transformed games to a JSON file for import const outputPath = path.join(__dirname, "../games-import.json"); fs.writeFileSync(outputPath, JSON.stringify(transformedGames, null, 2)); console.log(`✅ Transformed ${transformedGames.length} games`); console.log(`📁 Saved to: ${outputPath}`); console.log(`\nSample game:`); console.log(JSON.stringify(transformedGames[0], null, 2));