66 lines
2.0 KiB
JavaScript
66 lines
2.0 KiB
JavaScript
import pkg from "pg";
|
|
const { Pool } = pkg;
|
|
|
|
// Configuration de la base de données
|
|
const pool = new Pool({
|
|
host: "51.75.24.29",
|
|
port: 5433,
|
|
user: "postgres",
|
|
password: "postgres",
|
|
database: "thetiptop_dev",
|
|
});
|
|
|
|
async function activateGame() {
|
|
try {
|
|
console.log('🎮 Activation du jeu...\n');
|
|
|
|
// Nouvelle période du jeu : du 1er novembre 2025 au 31 décembre 2025
|
|
const startDate = '2025-11-01 00:00:00';
|
|
const endDate = '2025-12-31 23:59:59';
|
|
|
|
// Mettre à jour la configuration du jeu
|
|
const result = await pool.query(
|
|
`UPDATE game_settings
|
|
SET start_date = $1,
|
|
end_date = $2,
|
|
is_active = TRUE,
|
|
updated_at = NOW()
|
|
WHERE id = (SELECT id FROM game_settings ORDER BY created_at DESC LIMIT 1)
|
|
RETURNING *`,
|
|
[startDate, endDate]
|
|
);
|
|
|
|
if (result.rows.length === 0) {
|
|
console.log('❌ Aucune configuration de jeu trouvée');
|
|
await pool.end();
|
|
return;
|
|
}
|
|
|
|
const settings = result.rows[0];
|
|
const now = new Date();
|
|
|
|
console.log('✅ Jeu activé avec succès!\n');
|
|
console.log('━'.repeat(60));
|
|
console.log('📊 NOUVELLE CONFIGURATION DU JEU');
|
|
console.log('━'.repeat(60));
|
|
console.log(` Status: ✅ ACTIF`);
|
|
console.log(` Date de début: ${new Date(settings.start_date).toLocaleString('fr-FR')}`);
|
|
console.log(` Date de fin: ${new Date(settings.end_date).toLocaleString('fr-FR')}`);
|
|
console.log(` Date actuelle: ${now.toLocaleString('fr-FR')}`);
|
|
console.log(` Tickets totaux: ${settings.total_tickets.toLocaleString('fr-FR')}`);
|
|
console.log(` Tickets générés: ${settings.tickets_generated}`);
|
|
console.log('━'.repeat(60));
|
|
|
|
console.log('\n🎉 Le jeu est maintenant actif !');
|
|
console.log(' Vous pouvez maintenant utiliser les codes de tickets pour jouer.\n');
|
|
|
|
await pool.end();
|
|
} catch (error) {
|
|
console.error('❌ Erreur:', error.message);
|
|
await pool.end();
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
activateGame();
|