Refactoring : Fonctionnalité de Création d'un évènement est OK.

This commit is contained in:
DahoudG
2024-09-01 05:07:43 +00:00
parent a1fce6bf27
commit b8d7cfcb8d
4 changed files with 105 additions and 20 deletions

View File

@@ -22,7 +22,7 @@ class EventModel {
required this.location,
required this.category,
required this.link,
required this.imageUrl,
this.imageUrl,
required this.creator,
required this.participants,
});
@@ -36,14 +36,14 @@ class EventModel {
date: json['date'],
location: json['location'],
category: json['category'],
link: json['link'],
imageUrl: json['imageUrl'],
link: json['link'] ?? '', // Assure qu'il ne soit pas null
imageUrl: json['imageUrl'] ?? '', // Assure qu'il ne soit pas null
creator: UserModel.fromJson(json['creator']),
participants: json['participants'] != null
? (json['participants'] as List)
.map((user) => UserModel.fromJson(user))
.toList()
: [],
: [], // Si participants est null, retourne une liste vide
);
}