feat: ajout de la configuration des émulateurs Firebase et mise à jour des services pour utiliser le backend sécurisé

This commit is contained in:
ElPoyo
2026-01-06 23:43:36 +01:00
parent fb6a271f66
commit 13a890606d
24 changed files with 1905 additions and 375 deletions

View File

@@ -359,6 +359,14 @@ class EquipmentModel {
});
factory EquipmentModel.fromMap(Map<String, dynamic> map, String id) {
// Fonction helper pour convertir Timestamp ou String ISO en DateTime
DateTime? _parseDate(dynamic value) {
if (value == null) return null;
if (value is Timestamp) return value.toDate();
if (value is String) return DateTime.tryParse(value);
return null;
}
// Gestion des listes
final List<dynamic> parentBoxIdsRaw = map['parentBoxIds'] ?? [];
final List<String> parentBoxIds = parentBoxIdsRaw.map((e) => e.toString()).toList();
@@ -383,13 +391,13 @@ class EquipmentModel {
length: map['length']?.toDouble(),
width: map['width']?.toDouble(),
height: map['height']?.toDouble(),
purchaseDate: (map['purchaseDate'] as Timestamp?)?.toDate(),
nextMaintenanceDate: (map['nextMaintenanceDate'] as Timestamp?)?.toDate(),
purchaseDate: _parseDate(map['purchaseDate']),
nextMaintenanceDate: _parseDate(map['nextMaintenanceDate']),
maintenanceIds: maintenanceIds,
imageUrl: map['imageUrl'],
notes: map['notes'],
createdAt: (map['createdAt'] as Timestamp?)?.toDate() ?? DateTime.now(),
updatedAt: (map['updatedAt'] as Timestamp?)?.toDate() ?? DateTime.now(),
createdAt: _parseDate(map['createdAt']) ?? DateTime.now(),
updatedAt: _parseDate(map['updatedAt']) ?? DateTime.now(),
);
}