feat: Propagate user profile updates to group member details and remove trip code sharing UI.
Some checks failed
Deploy to Play Store / build_and_deploy (push) Has been cancelled
Some checks failed
Deploy to Play Store / build_and_deploy (push) Has been cancelled
This commit is contained in:
@@ -286,4 +286,42 @@ class GroupRepository {
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateMemberDetails({
|
||||
required String userId,
|
||||
String? firstName,
|
||||
String? lastName,
|
||||
String? profilePictureUrl,
|
||||
}) async {
|
||||
try {
|
||||
// 1. Trouver tous les groupes où l'utilisateur est membre
|
||||
final groupsSnapshot = await _groupsCollection
|
||||
.where('memberIds', arrayContains: userId)
|
||||
.get();
|
||||
|
||||
// 2. Mettre à jour les infos du membre dans chaque groupe
|
||||
for (final groupDoc in groupsSnapshot.docs) {
|
||||
final memberRef = _membersCollection(groupDoc.id).doc(userId);
|
||||
|
||||
final updates = <String, dynamic>{};
|
||||
if (firstName != null) updates['firstName'] = firstName;
|
||||
if (lastName != null) updates['lastName'] = lastName;
|
||||
if (profilePictureUrl != null) {
|
||||
updates['profilePictureUrl'] = profilePictureUrl;
|
||||
}
|
||||
|
||||
if (updates.isNotEmpty) {
|
||||
await memberRef.update(updates);
|
||||
}
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
_errorService.logError(
|
||||
'GroupRepository',
|
||||
'Erreur update member details: $e',
|
||||
stackTrace,
|
||||
);
|
||||
// On ne throw pas d'exception ici pour ne pas bloquer l'update user principal
|
||||
// C'est une opération "best effort"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user