naming typo fix
This commit is contained in:
parent
744fccfc54
commit
5ed71b8f91
2 changed files with 4 additions and 4 deletions
|
@ -54,7 +54,7 @@ def update_event(event_id):
|
||||||
if updated_event:
|
if updated_event:
|
||||||
return jsonify(updated_event.to_dict()), 200
|
return jsonify(updated_event.to_dict()), 200
|
||||||
else:
|
else:
|
||||||
return jsonify({'error': 'Failed to update event'}), 400
|
return jsonify({'error': 'Event not found'}), 404
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({'error': str(e)}), 500
|
return jsonify({'error': str(e)}), 500
|
||||||
|
|
||||||
|
@ -67,6 +67,6 @@ def delete_event(event_id):
|
||||||
if deleted_event:
|
if deleted_event:
|
||||||
return jsonify(deleted_event.to_dict()), 200
|
return jsonify(deleted_event.to_dict()), 200
|
||||||
else:
|
else:
|
||||||
return jsonify({'error': 'Failed to delete event'}), 400
|
return jsonify({'error': 'Event not found'}), 404
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({'error': str(e)}), 500
|
return jsonify({'error': str(e)}), 500
|
|
@ -4,8 +4,6 @@ from datetime import datetime
|
||||||
class EventService:
|
class EventService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_event(data):
|
def create_event(data):
|
||||||
print("#########")
|
|
||||||
print(data)
|
|
||||||
new_event = Event(
|
new_event = Event(
|
||||||
title=data['title'],
|
title=data['title'],
|
||||||
description=data.get('description', ''),
|
description=data.get('description', ''),
|
||||||
|
@ -36,6 +34,8 @@ class EventService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_event(event_id, data):
|
def update_event(event_id, data):
|
||||||
event = Event.query.get(event_id)
|
event = Event.query.get(event_id)
|
||||||
|
if not event:
|
||||||
|
return None
|
||||||
event.title = data['title']
|
event.title = data['title']
|
||||||
event.description = data.get('description', '')
|
event.description = data.get('description', '')
|
||||||
event.location = data.get('location', '')
|
event.location = data.get('location', '')
|
||||||
|
|
Loading…
Reference in a new issue