diff --git a/src/app.py b/src/app.py index 4ebb1d9..a8e7bbd 100644 --- a/src/app.py +++ b/src/app.py @@ -56,11 +56,15 @@ def get_activities(): def signup_for_activity(activity_name: str, email: str): """Sign up a student for an activity""" # Validate activity exists + if activity_name not in activities: raise HTTPException(status_code=404, detail="Activity not found") # Get the specific activity activity = activities[activity_name] + # Validate student is not already signed up + if email in activity["participants"]: + raise HTTPException(status_code=400, detail="Student is already signed up") # Add student activity["participants"].append(email) diff --git a/{file_path} b/{file_path} new file mode 100644 index 0000000..02eddd5 --- /dev/null +++ b/{file_path} @@ -0,0 +1,6 @@ +Sports: rock climbing +Sports: badminton +Artistic: pottery +Artistic: digital illustration +Intellectual: chess puzzles +Intellectual: philosophy reading