Skip to content
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 profile documentation #412

Closed
wants to merge 7 commits into from
Closed
Changes from 2 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
26 changes: 23 additions & 3 deletions server/endpoints/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export interface ProfileRequest {
token: string;
}

/**
* Returns true if [token] matches the email if the given token is valid and false otherwise
* This method authenticates the user token through the Google API.
* @param token: google authentication token that is checked to see if it is not
* empty and an ASCII value
* @requires that you have a handleVerifyError, like as follows:
* verify(token, function(){//do whatever}).catch(function(error)){}
* @returns: Endpoint with type ProfileRequest
*/
export const getStudentEmailByToken: Endpoint<ProfileRequest> = {
guard: [body("token").notEmpty().isAscii()],
callback: async (ctx: Context, request: ProfileRequest) => {
Expand All @@ -36,7 +45,10 @@ export const getStudentEmailByToken: Endpoint<ProfileRequest> = {
};

/**
* Counts the number of reviews made by a given student id.
* Returns the number of reviews that match a given netId and null if there are none
* This method counts the total number of reviews left by a student.
* @param netId: netId that is checked to see if it is not empty and an ASCII value
* @returns: Endpoint with type NetIdQuery
*/
export const countReviewsByStudentId: Endpoint<NetIdQuery> = {
guard: [body("netId").notEmpty().isAscii()],
Expand All @@ -60,7 +72,11 @@ export const countReviewsByStudentId: Endpoint<NetIdQuery> = {
};

/**
* [getTotalLikesByStudentId] returns the total number of likes a student has gotten on their reviews
* Returns the number of likes that match the reviewIds associated with a given
* netId and error if there are none
* This method counts the total number of likes received by a student.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey Helen, nice work! I think here we should change "This method counts the total number of likes received by a student." to "This method calculates the total number of likes a student has received on all their reviews." to be a little more clear

* @param netId: netId that is checked to see if it is not empty and an ASCII value
* @returns: Endpoint with type NetIdQuery
*/
export const getTotalLikesByStudentId: Endpoint<NetIdQuery> = {
guard: [body("netId").notEmpty().isAscii()],
Expand Down Expand Up @@ -94,7 +110,11 @@ export const getTotalLikesByStudentId: Endpoint<NetIdQuery> = {
};

/**
* [getReviewsByStudentId] returns a list of review objects that are created by the given student's netID
* Returns the reviews that match the reviewIds associated with a given netId and
* error if there are none
* This method gets all of the reviews created by a student.
* @param netId: netId that is checked to see if it is not empty and an ASCII value
* @returns: Endpoint with type NetIdQuery
*/
export const getReviewsByStudentId: Endpoint<NetIdQuery> = {
guard: [body("netId").notEmpty().isAscii()],
Expand Down