Fix : Mise a jour et création d'un événement
This commit is contained in:
@@ -118,10 +118,17 @@ class EventFormService {
|
||||
|
||||
static Future<void> updateEvent(EventModel event) async {
|
||||
try {
|
||||
await _apiService.call('updateEvent', {
|
||||
'eventId': event.id,
|
||||
'data': event.toMap(),
|
||||
});
|
||||
if (event.id.isEmpty) {
|
||||
throw Exception("Cannot update event: Event ID is empty");
|
||||
}
|
||||
|
||||
developer.log('Updating event with ID: ${event.id}', name: 'EventFormService');
|
||||
|
||||
final eventData = event.toMap();
|
||||
eventData['eventId'] = event.id;
|
||||
await _apiService.call('updateEvent', eventData);
|
||||
|
||||
developer.log('Event updated successfully', name: 'EventFormService');
|
||||
} catch (e) {
|
||||
developer.log('Error updating event', name: 'EventFormService', error: e);
|
||||
rethrow;
|
||||
@@ -172,12 +179,19 @@ class EventFormService {
|
||||
}
|
||||
|
||||
static Future<void> updateEventDocuments(String eventId, List<Map<String, String>> documents) async {
|
||||
// Utiliser l'API pour mettre à jour les documents
|
||||
try {
|
||||
if (eventId.isEmpty) {
|
||||
throw Exception("Event ID cannot be empty");
|
||||
}
|
||||
|
||||
developer.log('Updating event documents for ID: $eventId (${documents.length} documents)', name: 'EventFormService');
|
||||
|
||||
await _apiService.call('updateEvent', {
|
||||
'eventId': eventId,
|
||||
'documents': documents,
|
||||
});
|
||||
|
||||
developer.log('Event documents updated successfully', name: 'EventFormService');
|
||||
} catch (e) {
|
||||
developer.log('Error updating event documents', name: 'EventFormService', error: e);
|
||||
throw Exception("Could not update event documents.");
|
||||
|
||||
Reference in New Issue
Block a user