Refactoring + Checkpoint
This commit is contained in:
@@ -17,6 +17,8 @@ class Friend extends Equatable {
|
||||
final String? email; // Adresse e-mail, optionnelle mais typiquement présente
|
||||
final String? imageUrl; // URL de l'image de profil, optionnelle
|
||||
final FriendStatus status; // Statut de l'ami, avec une valeur par défaut `unknown`
|
||||
final String? dateAdded;
|
||||
final String? lastInteraction;
|
||||
|
||||
/// Logger statique pour suivre toutes les actions et transformations liées à [Friend].
|
||||
static final Logger _logger = Logger();
|
||||
@@ -31,6 +33,8 @@ class Friend extends Equatable {
|
||||
this.email,
|
||||
this.imageUrl,
|
||||
this.status = FriendStatus.unknown,
|
||||
this.dateAdded,
|
||||
this.lastInteraction,
|
||||
}) {
|
||||
assert(friendId.isNotEmpty, 'friendId ne doit pas être vide');
|
||||
_logger.i('[LOG] Création d\'un objet Friend : ID = $friendId, Nom = $friendFirstName $friendLastName');
|
||||
@@ -53,7 +57,7 @@ class Friend extends Equatable {
|
||||
friendFirstName: json['friendFirstName'] as String? ?? 'Ami inconnu',
|
||||
friendLastName: json['friendLastName'] as String? ?? '',
|
||||
email: json['email'] as String?,
|
||||
imageUrl: json['imageUrl'] as String?,
|
||||
imageUrl: json['friendProfileImageUrl'] as String?,
|
||||
status: _parseStatus(json['status'] as String?),
|
||||
);
|
||||
}
|
||||
@@ -81,7 +85,7 @@ class Friend extends Equatable {
|
||||
'friendFirstName': friendFirstName,
|
||||
'friendLastName': friendLastName,
|
||||
'email': email,
|
||||
'imageUrl': imageUrl,
|
||||
'friendProfileImageUrl': imageUrl,
|
||||
'status': status.name,
|
||||
};
|
||||
_logger.i('[LOG] Conversion Friend -> JSON : $json');
|
||||
@@ -99,6 +103,8 @@ class Friend extends Equatable {
|
||||
String? email,
|
||||
String? imageUrl,
|
||||
FriendStatus? status,
|
||||
String? lastInteraction,
|
||||
String? dateAdded,
|
||||
}) {
|
||||
final newFriend = Friend(
|
||||
friendId: friendId ?? this.friendId,
|
||||
|
||||
Reference in New Issue
Block a user