This API provides a set of endpoints designed to manage user interactions with events, clubs, and other members in the system. The primary functionality is organized into several sections: Recruitment, Users, Events, Clubs, and Friends.
Creates a new recruitment post for a club. The post includes details like the club's ID, title, posting date, deadline, and application link.
req: Request- The HTTP request object containing the recruitment details in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
{
"club_id": number, // ID of the club creating the recruitment post
"title": string, // Title of the recruitment post
"date_posted": string?, // (Optional) Date the post was created; defaults to current timestamp
"deadline": string, // Deadline for applications
"application_link": string // URL link to the application form
}
- 201 Created: Recruitment post successfully created.
"club_id": number,
"title": string,
"date_posted": string,
"deadline": string,
"application_link": string
}
- 400 Bad Request: Missing required fields.
{ "error": "Missing required fields" }
- 500 Internal Server Error: Database or server error.
{ "error": "Recruitment could not be created: <error message>" }
Deletes an existing recruitment post by its unique ID.
req: Request- The HTTP request object with recruitment_id as a route parameter.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- recruitment_id (string): Unique ID of the recruitment post to delete.
- 200 OK: Recruitment post successfully deleted.
{ "message": "Recruitment deleted successfully" }
- 400 Bad Request: Missing required recruitment_id parameter.
{ "error": "Missing required field: recruitment_id" }
- 404 Not Found: Recruitment post not found.
{ "error": "Recruitment not found" }
- 500 Internal Server Error: Database or server error.
{ "error": "Error deleting recruitment: <error message>" }
Retrieves all recruitment posts for a user, filtered by the clubs they have marked as favorites.
req: Request- The HTTP request object with user_id in the query string.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- user_id (string): Unique ID of the user to filter recruitment posts.
- 200 OK: Successfully retrieved recruitment posts.
{
"data": [
{
"recruitment_id": number,
"club_id": number,
"title": string,
"date_posted": string,
"deadline": string,
"application_link": string,
"club_name": string
},
...
]
}
- 500 Internal Server Error: Database or server error.
{ "error": "Error getting recruitment posts: <error message>" }
Creates a new event for a club. The event includes details such as the club's ID, title, date, room, and optional incentives.
req: Request- The HTTP request object containing the event details in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
{
"club_id": number, // ID of the club hosting the event
"title": string, // Title of the event
"date": string, // Date of the event
"room": string, // Location of the event
"incentives": string? // (Optional) Incentives for attending the event
}
- 201 Created: Event successfully created
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
}
- 400 Bad Request: Missing required fields.
{ "error": "Missing required fields" }
- 500 Internal Server Error: Database or server error.
{ "error": "Event could not be created, + <error message>" }
Creates a new event for a club. The event includes details such as the club's ID, title, date, room, and optional incentives.
req: Request- The HTTP request object with event_id as a route parameter.res: Response- The HTTP response object.db: Database- The SQLite database instance.
event_id: string- Unique ID of the event to delete.
- 200 OK: Event successfully deleted.
{ "message": "Event deleted successfully" }
- 400 Bad Request: Missing event_id parameter.
{ "error": "Missing required field: event_id" }
- 404 Not Found: Event not found.
{ "error": "Event not found" }
- 500 Internal Server Error: Database or server error.
{ "error": "Error deleting event: <error message>" }
Fetches all events for all clubs.
req: Request- The HTTP request object.res: Response- The HTTP response object.db: Database- The SQLite database instance.
event_id: string- Unique ID of the event to delete.
- 200 OK: Successfully retrieved all events.
{
"data": [
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
},
...
]
}
Fetches all events for all clubs.
req: Request- The HTTP request object.res: Response- The HTTP response object.db: Database- The SQLite database instance.
event_id: string- Unique ID of the event to delete.
- 200 OK: Successfully retrieved all events.
{
"data": [
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
},
...
]
}
- 500 Internal Server Error: Database or server error.
{ "error": "Error getting events: <error message>" }
Creates a new event for a club. The event includes details such as the club's ID, title, date, room, and optional incentives.
req: Request- The HTTP request object with event_id as a route parameter.res: Response- The HTTP response object.db: Database- The SQLite database instance.
event_id: string- Unique ID of the event to delete.
- 200 OK: Event successfully deleted.
{ "message": "Event deleted successfully" }
- 400 Bad Request: Missing event_id parameter.
{ "error": "Missing required field: event_id" }
- 404 Not Found: Event not found.
{ "error": "Event not found" }
- 500 Internal Server Error: Database or server error.
{ "error": "Error deleting event: <error message>" }
Fetches all upcoming events for a specific user based on their club preferences.
req: Request- The HTTP request object containing user_id in the query.res: Response- The HTTP response object.db: Database- The SQLite database instance.
user_id: string - IDof the user whose upcoming events are to be retrieved.
- 200 OK: Successfully retrieved all events.
{
"data": [
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
},
...
]
}
- 500 Internal Server Error: Database or server error during fetching.
{ "error": "Error getting user upcoming events: <error message>" }
Fetches all non-favorite events for a user based on their club preferences.
req: Request- The HTTP request object containing user_id in the query.res: Response- The HTTP response object.db: Database- The SQLite database instance.
user_id: string - IDof the user whose non-favorite events are to be retrieved.
- 200 OK: Successfully retrieved all events.
{
"data": [
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
},
...
]
}
- 500 Internal Server Error: Database or server error during fetching.
{ "error": "Error getting user upcoming non-favorite events: <error message>" }
Fetches all favorite events for a user based on their club preferences.
req: Request- The HTTP request object containing user_id in the query.res: Response- The HTTP response object.db: Database- The SQLite database instance.
user_id: string - IDof the user whose non-favorite events are to be retrieved.
- 200 OK: Successfully retrieved all events.
{
"data": [
{
"club_id": number,
"title": string,
"date": string,
"room": string,
"incentives": string | null
},
...
]
}
- 500 Internal Server Error: Database or server error during fetching.
{ "error": "Error getting user favorite events: <error message>" }
Fetches all users from the database.
req: Request- The HTTP request object.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully retrieved all users.
[
{
"user_id": number,
"name": string,
"email": string,
"college": string | null,
"major": string | null,
"year": string | null,
"minor": string | null,
"securityQuestion": string | null,
"securityAnswer": string | null
},
...
]
- 500 Internal Server Error: Database or server error.
{ "error": "Failed to fetch users" }
Registers a new temporary user in the database.
req: Request- The HTTP request object containing the name, email, and password fields in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 201 Created: Successfully created a temporary user.
{ "message": "Temporary user created", "tempId": number }
- 400 Bad Request: Missing required fields (name, email, password).
{ "error": "Missing required fields" }
- 409 Conflict: The email is already registered.
{ "error": "Email is already registered" }
- 500 Internal Server Error: Database or server error during registration.
{ "error": "Error registering user: <error message>" }
Updates the profile information of a temporary user.
req: Request- The HTTP request object containing the tempId, college, major, year, and minor fields in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully updated the temporary user's profile.
{ "message": "Temporary profile updated successfully" }
- 400 Bad Request: Missing required tempId.
{ "error": "Missing required temp ID" }
- 500 Internal Server Error: Database or server error during update
{ "error": "Error updating profile: <error message>" }
Updates the security question and answer of a temporary user.
req: Request- The HTTP request object containing the tempId, securityQuestion, and securityAnswer fields in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully updated the user's security information.
{ "message": "Security information updated successfully" }
- 400 Bad Request: Missing required fields (tempId, securityQuestion, securityAnswer).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Database or server error during update.
{ "error": "Error updating security information: <error message>" }
Finalizes user registration by moving data from the temporary user table to the main users table.
req: Request- The HTTP request object containing the tempId field in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 201 Created: Successfully finalized user registration.
{ "message": "User registration finalized", "user_id": number }
- 400 Bad Request: Missing required tempId.
{ "error": "Missing required temp ID" }
- 404 Not Found: The temporary user was not found.
{ "error": "Temporary user not found" }
- 500 Internal Server Error: Database or server error during finalization.
{ "error": "Error finalizing user registration: <error message>" }
Logs a user into the system by verifying their email and password.
req: Request- The HTTP request object containing the email and password fields in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully logged in.
{ "message": "Logged in successfully", "user_id": number }
- 400 Bad Request: Missing required fields (email, password).
{ "error": "Missing required fields" }
- 401 Unauthorized: Incorrect username or password.
{ "message": "Username or password does not match" }
- 500 Internal Server Error: Database or server error during login.
{ "error": "Log in unsuccessful: <error message>" }
Verifies the security question and answer for a user during a password recovery process.
req: Request- The HTTP request object containing the email, securityQuestion, and securityAnswer fields in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Security details match.
{ "message": "Verification successful", "verified": true }
- 401 Unauthorized: Security details do not match.
{ "error": "Security details do not match", "verified": false }
- 404 Not Found: User not found.
{ "error": "User not found" }
- 500 Internal Server Error: Database or server error during verification.
{ "error": "Server error: <error message>" }
Updates the password for a user identified by their email.
req: Request- The HTTP request object containing email and newPassword in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully updated the user's password.
{ "message": "Password updated successfully" }
- 400 Bad Request: Missing required fields (email, newPassword).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error updating the password in the database.
{ "error": "Server error: <error message>" }
Adds an event to the list of favorite events for a user.
req: Request- The HTTP request object containing user_id and event_id in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully favorited the event.
{ "message": "Event favorited successfully", "user_id": number, "event_id": number }
- 400 Bad Request: Missing required fields (user_id, event_id).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error favoriting the event.
{ "error": "Event could not be favorited: <error message>" }
Removes an event from the user's list of favorite events.
req: Request- The HTTP request object containing user_id and event_id in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully unfavorited the event.
{ "message": "Event unfavorited successfully", "user_id": number, "event_id": number }
- 400 Bad Request: Missing required fields (user_id, event_id).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error unfavoriting the event.
{ "error": "Event could not be unfavorited: <error message>" }
Adds a club to the list of favorite clubs for a user.
req: Request- The HTTP request object containing user_id and club_id in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully favorited the club.
{ "message": "Club favorited successfully", "user_id": number, "club_id": number }
- 400 Bad Request: Missing required fields (user_id, club_id).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error favoriting the club.
{ "error": "Club could not be favorited: <error message>" }
Removes a club from the user's list of favorite clubs.
req: Request- The HTTP request object containing user_id and club_id in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully unfavorited the club.
{ "message": "Club unfavorited successfully", "user_id": number, "club_id": number }
- 400 Bad Request: Missing required fields (user_id, club_id).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error unfavoriting the club.
{ "error": "Club could not be unfavorited: <error message>" }
Updates the privacy setting for a user.
req: Request- The HTTP request object containing user_id and newPrivacyState in the body.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully updated the privacy setting.
{ "message": "Privacy setting updated successfully" }
- 400 Bad Request: Missing required fields (user_id, newPrivacyState).
{ "error": "Missing required fields" }
- 500 Internal Server Error: Error updating the privacy setting in the database.
{ "error": "Error updating privacy setting: <error message>" }
Fetches the user data for a given user ID.
req: Request- The HTTP request object containing the user_id in the query.res: Response- The HTTP response object.db: Database- The SQLite database instance.
- 200 OK: Successfully retrieved the user data.
{
"user_id": number,
"name": string,
"email": string,
"college": string | null,
"major": string | null,
"year": string | null,
"minor": string | null,
"private": number
}
- 400 Bad Request: Missing required user_id.
{ "error": "Missing required user_id" }
- 500 Internal Server Error: Error fetching the user data.
{ "error": "Failed to fetch user" }