# EM2RP - Déploiement automatique du système d'alertes # Ce script déploie les Cloud Functions et vérifie le déploiement Write-Host "========================================" -ForegroundColor Cyan Write-Host " EM2RP - Déploiement Cloud Functions " -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # Vérifier qu'on est dans le bon répertoire if (-not (Test-Path ".\firebase.json")) { Write-Host "❌ ERREUR: Vous devez lancer ce script depuis C:\src\EM2RP\em2rp\" -ForegroundColor Red exit 1 } # Vérifier que le fichier .env existe if (-not (Test-Path ".\functions\.env")) { Write-Host "❌ ERREUR: Le fichier functions\.env est manquant" -ForegroundColor Red Write-Host " Créez ce fichier avec les identifiants SMTP" -ForegroundColor Yellow exit 1 } Write-Host "✅ Vérifications préliminaires OK" -ForegroundColor Green Write-Host "" # Déployer les fonctions Write-Host "🚀 Déploiement des Cloud Functions en cours..." -ForegroundColor Cyan Write-Host " (Cela peut prendre 3-5 minutes)" -ForegroundColor Gray Write-Host "" $deployResult = firebase deploy --only functions 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host "" Write-Host "========================================" -ForegroundColor Green Write-Host " ✅ DÉPLOIEMENT RÉUSSI" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green Write-Host "" # Lister les fonctions déployées Write-Host "📋 Fonctions déployées:" -ForegroundColor Cyan firebase functions:list Write-Host "" Write-Host "🎯 Prochaines étapes:" -ForegroundColor Yellow Write-Host " 1. Migrer les préférences utilisateurs: cd functions; node migrate_email_prefs.js" -ForegroundColor White Write-Host " 2. Tester la création d'un événement avec workforce" -ForegroundColor White Write-Host " 3. Vérifier les logs: firebase functions:log --limit 20" -ForegroundColor White Write-Host "" Write-Host "📚 Voir DEPLOY_NOW.md pour plus de détails" -ForegroundColor Gray } else { Write-Host "" Write-Host "========================================" -ForegroundColor Red Write-Host " ❌ ERREUR DE DÉPLOIEMENT" -ForegroundColor Red Write-Host "========================================" -ForegroundColor Red Write-Host "" Write-Host "Erreur rencontrée:" -ForegroundColor Yellow Write-Host $deployResult -ForegroundColor Red Write-Host "" Write-Host "💡 Solutions possibles:" -ForegroundColor Yellow Write-Host " - Si 'Quota exceeded': Attendez 2 minutes et relancez" -ForegroundColor White Write-Host " - Vérifiez que Firebase CLI est à jour: firebase --version" -ForegroundColor White Write-Host " - Consultez les logs: firebase functions:log" -ForegroundColor White exit 1 }