the-tip-top-backend/scripts/clean-backend.js
2025-11-17 23:47:54 +01:00

43 lines
1.1 KiB
JavaScript

/**
* Script de nettoyage du backend - suppression fonctionnalités non demandées
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const filesToDelete = [
'src/controllers/email-campaign.controller.js',
'src/routes/email-campaign.routes.js',
];
console.log('🧹 Nettoyage du backend...\n');
let deleted = 0;
let notFound = 0;
filesToDelete.forEach(filePath => {
const fullPath = path.join(__dirname, '..', filePath);
try {
if (fs.existsSync(fullPath)) {
fs.unlinkSync(fullPath);
console.log(`✅ Supprimé: ${filePath}`);
deleted++;
} else {
console.log(`⚠️ N'existe pas: ${filePath}`);
notFound++;
}
} catch (error) {
console.error(`❌ Erreur lors de la suppression de ${filePath}:`, error.message);
}
});
console.log(`\n📊 Résumé:`);
console.log(` • Fichiers supprimés: ${deleted}`);
console.log(` • Fichiers non trouvés: ${notFound}`);
console.log(`\n✨ Nettoyage backend terminé!`);