41 lines
1.1 KiB
Dart
41 lines
1.1 KiB
Dart
import 'dart:io';
|
|
import 'package:travel_mate/services/trip_image_service.dart';
|
|
|
|
/// Script utilitaire pour nettoyer les images inutilisées
|
|
/// À exécuter manuellement si nécessaire
|
|
void main() async {
|
|
try {
|
|
final tripImageService = TripImageService();
|
|
|
|
// Remplacez par votre ID utilisateur
|
|
// Vous pouvez le récupérer depuis Firebase Auth dans votre app
|
|
const userId = 'YOUR_USER_ID_HERE';
|
|
|
|
if (userId == 'YOUR_USER_ID_HERE') {
|
|
return;
|
|
}
|
|
|
|
final stats = await tripImageService.getImageStatistics(userId);
|
|
|
|
if (stats['tripsWithImages'] > 0) {
|
|
await tripImageService.cleanupUnusedImages(userId);
|
|
|
|
final newStats = await tripImageService.getImageStatistics(userId);
|
|
} else {}
|
|
} catch (e) {
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
/*
|
|
Instructions d'utilisation:
|
|
|
|
1. Ouvrez votre application Flutter
|
|
2. Connectez-vous à votre compte
|
|
3. Dans le code de votre app, ajoutez temporairement:
|
|
print('User ID: ${FirebaseAuth.instance.currentUser?.uid}');
|
|
4. Récupérez votre User ID affiché dans la console
|
|
5. Remplacez 'YOUR_USER_ID_HERE' par votre ID dans ce script
|
|
6. Exécutez: dart run scripts/cleanup_images.dart
|
|
*/
|