Skip to content

Add registration validation and more activities #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,42 @@
"schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM",
"max_participants": 30,
"participants": ["[email protected]", "[email protected]"]
},
"Basketball Team": {
"description": "Competitive basketball training and games",
"schedule": "Tuesdays and Thursdays, 4:00 PM - 6:00 PM",
"max_participants": 15,
"participants": []
},
"Swimming Club": {
"description": "Swimming training and water sports",
"schedule": "Mondays and Wednesdays, 3:30 PM - 5:00 PM",
"max_participants": 20,
"participants": []
},
"Art Studio": {
"description": "Express creativity through painting and drawing",
"schedule": "Wednesdays, 3:30 PM - 5:00 PM",
"max_participants": 15,
"participants": []
},
"Drama Club": {
"description": "Theater arts and performance training",
"schedule": "Tuesdays, 4:00 PM - 6:00 PM",
"max_participants": 25,
"participants": []
},
"Debate Team": {
"description": "Learn public speaking and argumentation skills",
"schedule": "Thursdays, 3:30 PM - 5:00 PM",
"max_participants": 16,
"participants": []
},
"Science Club": {
"description": "Hands-on experiments and scientific exploration",
"schedule": "Fridays, 3:30 PM - 5:00 PM",
"max_participants": 20,
"participants": []
}
}

Expand All @@ -62,6 +98,10 @@ def signup_for_activity(activity_name: str, email: str):
# 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)
return {"message": f"Signed up {email} for {activity_name}"}