feat: implement equipment and container loading rollback functionality with corresponding backend cloud functions
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import 'package:em2rp/services/equipment_status_calculator.dart';
|
||||
import 'package:em2rp/services/api_service.dart';
|
||||
|
||||
class EventPreparationService {
|
||||
final ApiService _apiService = apiService;
|
||||
|
||||
/// Retourne true si l'équipement était absent du flux événementiel.
|
||||
///
|
||||
@@ -42,35 +38,7 @@ class EventPreparationService {
|
||||
);
|
||||
}
|
||||
|
||||
// === PRÉPARATION ===
|
||||
|
||||
/// Valider un équipement individuel en préparation
|
||||
Future<void> validateEquipmentPreparation(String eventId, String equipmentId) async {
|
||||
try {
|
||||
await _apiService.call('validateEquipmentPreparation', {
|
||||
'eventId': eventId,
|
||||
'equipmentId': equipmentId,
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error validating equipment preparation: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Valider tous les équipements en préparation
|
||||
Future<void> validateAllPreparation(String eventId) async {
|
||||
try {
|
||||
await _apiService.call('validateAllPreparation', {
|
||||
'eventId': eventId,
|
||||
});
|
||||
|
||||
// Invalider le cache des statuts d'équipement
|
||||
EquipmentStatusCalculator.invalidateGlobalCache();
|
||||
} catch (e) {
|
||||
print('Error validating all preparation: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// Ces méthodes ne sont plus utilisées et devraient être remplacées par des Cloud Functions
|
||||
// si nécessaire dans le futur
|
||||
@@ -85,46 +53,8 @@ class EventPreparationService {
|
||||
}
|
||||
*/
|
||||
|
||||
// === RETOUR ===
|
||||
|
||||
|
||||
/// Valider le retour d'un équipement individuel
|
||||
Future<void> validateEquipmentReturn(
|
||||
String eventId,
|
||||
String equipmentId, {
|
||||
int? returnedQuantity,
|
||||
}) async {
|
||||
try {
|
||||
await _apiService.call('validateEquipmentReturn', {
|
||||
'eventId': eventId,
|
||||
'equipmentId': equipmentId,
|
||||
if (returnedQuantity != null) 'returnedQuantity': returnedQuantity,
|
||||
});
|
||||
} catch (e) {
|
||||
print('Error validating equipment return: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Valider tous les retours
|
||||
Future<void> validateAllReturn(
|
||||
String eventId, [
|
||||
Map<String, int>? returnedQuantities,
|
||||
]) async {
|
||||
try {
|
||||
await _apiService.call('validateAllReturn', {
|
||||
'eventId': eventId,
|
||||
if (returnedQuantities != null) 'returnedQuantities': returnedQuantities,
|
||||
});
|
||||
|
||||
// Invalider le cache des statuts d'équipement
|
||||
EquipmentStatusCalculator.invalidateGlobalCache();
|
||||
} catch (e) {
|
||||
print('Error validating all return: $e');
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Deprecated('Use Cloud Functions instead')
|
||||
Future<void> completeReturnWithMissing(
|
||||
|
||||
Reference in New Issue
Block a user