Skip to content

Commit

Permalink
fix style to spec, revert bad comment
Browse files Browse the repository at this point in the history
  • Loading branch information
5oappy committed Mar 10, 2024
1 parent 6243a37 commit d674dcf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/v2/unavailability/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ def delete(self, user_id, event_id):
return {"message": "Unavailability event not found."}, 404
except Exception as e:
# HTTP 500 Internal Server Error
return {"description": "Internal server error", "error": str(e)}, 500
return {"message": "Internal server error", "error": str(e)}, 500


class VolunteerUnavailabilityV2(Resource):

@requires_auth
@marshal_with(volunteer_unavailability_time)
# @is_user_or_has_role(None, UserType.ROOT_ADMIN)
@is_user_or_has_role(None, UserType.ROOT_ADMIN)
def get(self, user_id):
with session_scope() as session:
volunteer_unavailability_record = fetch_event(session, user_id)
Expand All @@ -71,7 +71,7 @@ def post(self, user_id):
args = edit_parser.parse_args()
# Check if start time is earlier than end time
if args['start'] >= args['end']:
return {"description": "Start time must be earlier than end time"}, 400 # HTTP 400 Bad Request
return {"message": "Start time must be earlier than end time"}, 400 # HTTP 400 Bad Request

with session_scope() as session:
# checks if new time frame overlaps with any existing in the database for specific userId
Expand All @@ -86,8 +86,8 @@ def post(self, user_id):
for event in overlapping_events:
overlapping_details.append({
"eventId": event.eventId})
return {"description": "Time frames overlap with existing events",
"overlappingEvents": overlapping_details}, 400 # HTTP 400 Bad Request
return {"message": "Time frames overlap with existing events",
"overlapping_events": overlapping_details}, 400 # HTTP 400 Bad Request

eventId = create_event(
session,
Expand Down

0 comments on commit d674dcf

Please sign in to comment.