-
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 for memberUtils #571
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,8 +3,19 @@ import { createPatch } from 'diff'; | |||||
import { firestore } from 'firebase-admin'; | ||||||
import { archivedMembersByEmail } from '../members-archive'; | ||||||
|
||||||
/** | ||||||
* Get the netID of a member from their Cornell email. | ||||||
* @param email - the email of the member. | ||||||
* @returns the netID of the member. | ||||||
*/ | ||||||
export const getNetIDFromEmail = (email: string): string => email.split('@')[0]; | ||||||
|
||||||
/** | ||||||
* Filters the response from Google Cloud Storage to only include the filename | ||||||
* of the image. | ||||||
* @param images - a list of image filenmaes and their URLs. | ||||||
* @returns a list of profile images. | ||||||
*/ | ||||||
Comment on lines
+13
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd make this more descriptive of what the filename (does it contain the full path, does it contain the file extension, what file extensions are there, etc) looks like and what the purpose of the URL is. |
||||||
export const filterImagesResponse = ( | ||||||
images: readonly { readonly fileName: string; readonly url: string }[] | ||||||
): ProfileImage[] => | ||||||
|
@@ -15,6 +26,11 @@ export const filterImagesResponse = ( | |||||
fileName: image.fileName.slice(image.fileName.indexOf('/') + 1) | ||||||
})); | ||||||
|
||||||
/** | ||||||
* Serialize an `IdolMember` from a Firestore document reference. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should really also mention how this will lookup members from the members archive if the member isn't found in the db and will return undefined if the member doesn't exist in the db or the members archive. |
||||||
* @param docRef - the Firestore document reference. | ||||||
* @returns an `IdolMember` object of the member. | ||||||
*/ | ||||||
export const getMemberFromDocumentReference = async ( | ||||||
docRef: firestore.DocumentReference | ||||||
): Promise<IdolMember> => { | ||||||
|
@@ -27,6 +43,14 @@ export const getMemberFromDocumentReference = async ( | |||||
|
||||||
type SimplifiedMember = { readonly email: string }; | ||||||
|
||||||
/** | ||||||
* Computes the differences between the currently approved members and the | ||||||
* members who've submitted changes to their profiles. | ||||||
* @param allApprovedMembersList - the list of all approved members. | ||||||
* @param allLatestMembersList - the list of all members who've submitted changes. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is this just all the non-approved member data for all members? I.e. some members in this array could be the same as the member in the approvedMembersList? I'd double check this docstring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||||||
* @returns a list of `IdolMemberDiff` objects that contain all the differences | ||||||
* to each members' profiles. | ||||||
*/ | ||||||
export const computeMembersDiff = <M extends SimplifiedMember>( | ||||||
allApprovedMembersList: readonly M[], | ||||||
allLatestMembersList: readonly M[] | ||||||
|
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.