feat: Add full-screen receipt viewer, display trip participants in calendar, and restrict trip management options to creator.
This commit is contained in:
@@ -150,4 +150,43 @@ class UserRepository {
|
||||
throw Exception('Impossible de changer le mot de passe');
|
||||
}
|
||||
}
|
||||
|
||||
// Récupérer plusieurs utilisateurs par leurs IDs
|
||||
Future<List<User>> getUsersByIds(List<String> uids) async {
|
||||
if (uids.isEmpty) return [];
|
||||
|
||||
try {
|
||||
// Firestore 'in' query supports up to 10 values.
|
||||
// If we have more, we need to split into chunks.
|
||||
List<User> users = [];
|
||||
|
||||
// Remove duplicates
|
||||
final uniqueIds = uids.toSet().toList();
|
||||
|
||||
// Split into chunks of 10
|
||||
for (var i = 0; i < uniqueIds.length; i += 10) {
|
||||
final end = (i + 10 < uniqueIds.length) ? i + 10 : uniqueIds.length;
|
||||
final chunk = uniqueIds.sublist(i, end);
|
||||
|
||||
final querySnapshot = await _firestore
|
||||
.collection('users')
|
||||
.where(FieldPath.documentId, whereIn: chunk)
|
||||
.get();
|
||||
|
||||
for (var doc in querySnapshot.docs) {
|
||||
final data = doc.data();
|
||||
users.add(User.fromMap({...data, 'id': doc.id}));
|
||||
}
|
||||
}
|
||||
|
||||
return users;
|
||||
} catch (e, stackTrace) {
|
||||
_errorService.logError(
|
||||
'UserRepository',
|
||||
'Error retrieving users by IDs: $e',
|
||||
stackTrace,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user