-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add documentation to Team API #581
Conversation
[diff-counting] Significant lines: 32. |
backend/src/API/teamAPI.ts
Outdated
@@ -106,6 +131,12 @@ export const setTeam = async (teamBody: Team, member: IdolMember): Promise<Team> | |||
return teamBody; | |||
}; | |||
|
|||
/** | |||
* Deletes a team by removing all members, leaders, and formerMembers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracing this down, it seems like additionally, it removes all references between the member, leaders, and formerMembers from this team. I.e. member, leader, formerMember will no longer have his team under subteams
field and formerSubteams
field.
Maybe add that in the docstring?
* @param teamBody - The Team object that will be deleted. | ||
* @param member - The IdolMember that is requesting to delete the team. | ||
* @returns A promise that resolves to the deleted Team object. | ||
*/ | ||
export const deleteTeam = async (teamBody: Team, member: IdolMember): Promise<Team> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be in a separate PR, but I think this function should be renamed to clearTeam
, since the team document doesn't actually get deleted from the DB. Assuming that is intentional, all we're doing here is removing all members, leaders, and formerMembers from the team.
FYI the In a sense it's a "view" on the members collection. So
A team exists if there are 1+ members in the The team's former members are just the members where the team name is listed under the Any operations on teams in the BE are basically just operations on members docs to reflect/persist these team changes. And teams really aren't used at all within IDOL (could be an interesting idea to explore, maybe for coffee chats or whatever). The main reason the The original PR if you want more info: #199 |
Added documentation to
teamAPI.ts
. The @throws were not included due to the error messages being self-explanatory.