Refactoring : Fonctionnalité de Création d'un évènement est OK.
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:afterwork/data/models/event_model.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../core/errors/exceptions.dart';
|
||||
|
||||
/// Source de données pour les événements distants.
|
||||
class EventRemoteDataSource {
|
||||
final http.Client client;
|
||||
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user