-
Notifications
You must be signed in to change notification settings - Fork 2
APIs
IDOL currently has API for members and and teams, which utilize Firebase’s database operations.
Contents:
Overview
Data Types
Member API
Team API
The file api.ts
starts an express server, checks for valid user sessions, and describes the REST endpoints for both members and teams. Firebase configuration takes place in firebase.ts
.
The endpoint handlers are defined in membersAPI.ts
and teamAPI.ts
, while the DAO is defined in dao/MembersDao.ts
and dao/TeamsDao.ts
.
All endpoints return a status code and either the error message or the data on success. The status codes and error messages are according to HTTP response status codes.
Error codes for members:
200 - successful
401 - session user doesn’t exist in db
404 - member doesn’t exist in db
403 - user does not have permission to edit
400 - undefined email
500 - internal errors due to the db (various reasons)
Error codes for teams:
200 - successful
404 - members don’t exist in db or no team exists with the entered uuid
403 - user does not have permission to edit
400 - malformed teams or members on POST
500 - internal errors due to db (various reasons)
IDOL has defined the following data types for storing members and teams information.
Role: string
= lead or admin or tpm or developer or designer or business
RoleDescrition: string
= Lead or Admin or Technical PM or Product Manager or Developer or Designer or Business Analyst
Member = {
email: string;
netid: string;
firstName: string;
lastName: string;
graduation: string;
major: string;
doubleMajor(optional): string;
minor(optional): string;
website(optional): string;
linkedin(optional): string;
github(optional): string;
hometown: string;
about: string;
subteam: string;
otherSubteams(optional): string[];
role: Role;
roleDescription: RoleDescription
}
allMembers
- REST: get
- Authentication: not required
- Description: To get the information of all existing members.
- Return Type: AllMembersResponse
setMember
- REST: post
- Authentication: required
- Description: To add a member
- Permissions: Only admins or leads can add members
- Return Type: MemberResponse or ErrorResponse or undefined
updateMember
- REST: post
- Authentication: required
- Description: To update the information of an existing member
- Permissions: Only the same member, admins or leads can update a member’s information. The role, first name and last name for the member can only be updated by the admins or the leads.
- Return Type: MemberResponse or ErrorResponse or undefined
getMember
- REST: get
- Authentication: required
- Description: To get the information of an existing member
- Permissions: Only the same member, admins or leads can access the information of a member
- Parameter: email:string
- Return Type: MemberResponse or ErrorResponse or undefined
deleteMember
- REST: delete
- Authentication: required
- Description: To delete an existing member
- Permissions: Only admins or leads can delete members
- Parameters: email: string
- Return Type: MemberResponse or ErrorResponse or undefined
allTeams
- REST: get
- Authentication: required
- Description: To get the information of all existing teams
- Permissions: none
- Return Type: AllTeamsResponse or ErrorResponse or undefined
setTeam
- REST: post
- Authentication: required
- Description: To add a team
- Permissions: Only admins or leads can add a team
- Return Type: TeamResponse or ErrorResponse or undefined
deleteTeam
- REST: delete
- Authentication: required
- Description: To delete an existing team
- Permissions: Only admins or leads can delete a team
- Return Type: TeamResponse or ErrorResponse or undefined