Class Index | File Index

Classes


Built-In Namespace global

Method Summary
Method Attributes Method Name and Description
 
calculateRating(userRatingContainer)
Calculates a rating for a user.
 
checkLogin(cookie, email)
Checks a login, using the provided cookie and email.
 
computeInterestMatch(curr_user_interest, potential_match_interest)
Returns a score for interest match.
 
computeNormalizedScore(curr_score, curr_max)
Normalizes the score for the three categories, so all three types of scores have the same maximum and minimum values.
 
computeSkillMatch(curr_user_skill, potential_match_skill)
Returns a score for skill match.
 
deleteActivityUserID(req, res, next)
Middleware function to delete an activity for user with id userid.
 
deleteEventEventID(req, res, next)
Middleware function to delete event in database with id eventId.
 
editGetUserID(req, res, next)
Function to handle GET requests for user information.
 
editPostUserID(req, res, next)
Function to handle POST requests for user information.
 
eventsGetUserID(req, res, next)
Function to handle GET requests for user events page.
 
generateActivityMatches(curr_user_activities, potential_match_activities)
Generates a list of activity matches with an interest match and a skill match for each activity.
 
Return the locations of activities.
 
getAvailabilityMatch(curr_user_availability, potential_match_availability)
Returns maximum number of consecutive overlapping half-hours for two users.
 
getAvailabilityMatchScore(curr_user_availability, potential_match_availability)
Returns a score for the availability match between two users.
 
getBestActivityMatch(curr_user_activities, potential_match_activities)
Returns an object containing the best activity match between two users and the interest and skill level scores for that activity.
 
getBestActivityMatchFromList(activity_matches)
Returns an object containing the best activity match between two users and the interest and skill level scores for that activity, given a list of activities and scores.
 
getConfirmedEventsUserID(req, res, next)
Middleware function to get confirmed events from database that user with id userid has been matched to.
 
getEvent(req, res, next)
Middleware function to get event from database.
 
getEventDate(day, time_slot)
Return the time of the event in Unix Epoch time format.
 
getEventStartTime(curr_user_availability, potential_match_availability)
Returns the best time to meet up for two users.
 
getEventsUserID(req, res, next)
Middleware function to get events from database that user with id userid is invited to.
 
getMatchedEventsUserID(req, res, next)
Middleware function to get events from database that user with id userid has been matched to.
 
getPendingEventsUserID(req, res, next)
Middleware function to get pending events from database that user with id userid has been matched to.
 
getUserID(req, res, next)
Middleware function to get user with id userid.
 
getUsers(req, res, next)
Middleware function to get array of JSON objects representing all users.
 
indexGet(req, res, next)
Function to handle GET requests for index page.
 
insertEvent(properties, email, password, activity, startTime, endTime, location)
Function to insert a new event into the Events collection in MongoDB.
 
insertUser(properties, name, email, password)
Function to insert a new user into the Users collection in MongoDB.
 
loginGet(req, res)
Function to handle GET requests for login page.
 
loginPost(req, res)
Function to handle POST requests for login page.
 
matchGet(req, res, next)
Middleware function to get matches for a user.
 
matchUser(curr_user, potential_match)
Compute a match score for two users.
 
matchUsers(req, res, next, userId, matches)
Key function to generate matches for a single user, given the user id.
 
postActivityUserID(req, res, next)
Middleware function to update an activity for user with id userid.
 
postEvent(req, res, next)
Middleware function to post an event to the database.
 
profileGet(req, res, next)
Function to handle GET requests for user profile page.
 
putAvailabilityUserID(req, res, next)
Middleware function to update an availability cell for user with id userid.
 
putEventEventID(req, res, next)
Middleware function to update event in database with id eventId.
 
putNameUserID(req, res, next)
Middleware function to put a name into the user with id userid.
 
putPasswordUserID(req, res, next)
Middleware function to update the password for user with id userid.
 
putRateUserID(req, res, next)
Middleware function to let a user rate another user for an event.
 
registerGet(req, res, next)
Function to handle GET requests for user registration.
 
registerPost(req, res, next)
Function to handle POST requests for user registration.
 
routerProperties(req, res, next)
Function to return a JSON object containing the express router properties.
 
searchUsers(properties, criteria, processUsers, processUsers)
Function to search for all users meeting a criteria.
 
updateUser(properties, email, updateSet)
Function to return update a user's data in Users collection in MongoDB.
Method Detail
{number} calculateRating(userRatingContainer)
Calculates a rating for a user.
Defined in: profile.js.
Parameters:
{Object} userRatingContainer
The container that holds the user ratings.
Returns:
{number}

{boolean} checkLogin(cookie, email)
Checks a login, using the provided cookie and email.
Defined in: verify.js.
Parameters:
{Object} cookie
The cookie provided by the client's browser.
{String} email
The user's email.
Returns:
{boolean} Whether the given cookie and email verify.

{number} computeInterestMatch(curr_user_interest, potential_match_interest)
Returns a score for interest match. The computation most highly weights the current user's interests, and then weights the other user's interest level with secondary importance. Note that an interest level of 1 is the lowest possible interest for an activity, so this automatically results in a score of 0 for the interest match.
Defined in: match.js.
Parameters:
{number} curr_user_interest
Interest level for current user
{number} potential_match_interest
Interest level for other user
Returns:
{number} A normalized score representing the interest match between two users.

{number} computeNormalizedScore(curr_score, curr_max)
Normalizes the score for the three categories, so all three types of scores have the same maximum and minimum values.
Defined in: match.js.
Parameters:
{number} curr_score
Current score for that category
{number} curr_max
Maximum score for that cateogry
Returns:
{number} A normalized score representing the match score between two users for one category.

{number} computeSkillMatch(curr_user_skill, potential_match_skill)
Returns a score for skill match. The score is high if the two users have similar skill levels.
Defined in: match.js.
Parameters:
{number} curr_user_skill
Skill level of current user
{number} potential_match_skill
Skill level of potential match
Returns:
{number} A normalized score representing the skill level match between two users.

{Void} deleteActivityUserID(req, res, next)
Middleware function to delete an activity for user with id userid. API to access this function: DELETE /api/activity/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} deleteEventEventID(req, res, next)
Middleware function to delete event in database with id eventId. API to access this function: DELETE /api/event/:eventId
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Object} editGetUserID(req, res, next)
Function to handle GET requests for user information. Render the edit page corresponding to the user, or a 404 if the userID does not exist.
Defined in: edit.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose parameters contain the userID.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Object} editPostUserID(req, res, next)
Function to handle POST requests for user information. Updates the user's information in the database.
Defined in: edit.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose parameters contain the userID, email, password, and confirmation.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Object} eventsGetUserID(req, res, next)
Function to handle GET requests for user events page. Render the events page, or return a 404 error if the userID is not in the MongoDB database, or redirect to the login page with a 401 status code if the JSON web token does not verify.
Defined in: events.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose parameters include the userID.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Array} generateActivityMatches(curr_user_activities, potential_match_activities)
Generates a list of activity matches with an interest match and a skill match for each activity.
Defined in: match.js.
Parameters:
{Array} curr_user_activities
A list of activities for the current user with interest and skill level scores.
{Array} potential_match_activities
A list of activities for the potential match user with interest and skill level scores.
Returns:
{Array} List of objects with the potential match activities. Each object has the name of the potential match activity, a skill score, and an interest score.

{Object} getActivityLocations()
Return the locations of activities.
Defined in: match.js.
Returns:
{Object}

{Object} getAvailabilityMatch(curr_user_availability, potential_match_availability)
Returns maximum number of consecutive overlapping half-hours for two users. This could span over multiple days of the week, as long as it is a consecutive chunk of hours (i.e. 11:00 PM on Monday until 1 AM on Tuesday).
Defined in: match.js.
Parameters:
{Array} curr_user_availability
A list of true/false availabilities for the current user for each thirty-minute time slot on each day of the week.
{Array} potential_match_availability
A list of true/false availabilities for the potentialMatch for each thirty-minute time slot on each day of the week.
Returns:
{Object} The day, start time slot, and maximum number of overlapping consecutive half-hours between the two users.

{number} getAvailabilityMatchScore(curr_user_availability, potential_match_availability)
Returns a score for the availability match between two users. This is done by computing the largest overlapping block of time between the two users. This score is capped at a maximum defined by a constant MAX_AVAILABILITY_SCORE.
Defined in: match.js.
Parameters:
{Array} curr_user_availability
A list of true/false availabilities for the current user for each thirty-minute time slot on each day of the week.
{Array} potential_match_availability
A list of true/false availabilities for the potentialMatch for each thirty-minute time slot on each day of the week.
Returns:
{number} A score representing how good the time availability match is, where 0 represents a failed match and MAX_AVAILABILITY_SCORE is the highest possible match score for this category.

{Object} getBestActivityMatch(curr_user_activities, potential_match_activities)
Returns an object containing the best activity match between two users and the interest and skill level scores for that activity.
Defined in: match.js.
Parameters:
{Array} curr_user_activities
A list of activities for the current user with interest and skill level scores.
{Array} potential_match_activities
A list of activities for the potential match user with interest and skill level scores.
Returns:
{Object} The matched activity yielding the highest score for the current user. The object contains a field for the activity name, a field for the interest match score, and a field for the skill match score.

{Object} getBestActivityMatchFromList(activity_matches)
Returns an object containing the best activity match between two users and the interest and skill level scores for that activity, given a list of activities and scores. The best match is defined as having the highest skill score and interest score combined, disregarding activities with an interest match of 0.
Defined in: match.js.
Parameters:
{Array} activity_matches
Current activity matches with name, skill score, and interest score for each activity.
Returns:
{Object} The matched activity yielding the highest score for the current user. The object contains a field for the activity name, a field for the interest match score, and a field for the skill match score.

{Void} getConfirmedEventsUserID(req, res, next)
Middleware function to get confirmed events from database that user with id userid has been matched to. API to access this function: GET /api/confirmedevents/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} getEvent(req, res, next)
Middleware function to get event from database. API to access this function: GET /api/event
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

getEventDate(day, time_slot)
Return the time of the event in Unix Epoch time format.
Defined in: match.js.
Parameters:
{number} day
Day in database for the event, where 0 is Monday and 6 is Sunday
{number} time_slot
The timeslot in the database for the event, where 0 means midnight, one means 12:30 AM, etc.

{Array} getEventStartTime(curr_user_availability, potential_match_availability)
Returns the best time to meet up for two users. This is done by computing the largest overlapping block of time between the two users, and finding the start time of this largest overlapping block.
Defined in: match.js.
Parameters:
{Array>} curr_user_availability
A list of true/false availabilities for the current user for each thirty-minute time slot on each day of the week.
{Array>} potential_match_availability
A list of true/false availabilities for the potentialMatch for each thirty-minute time slot on each day of the week.
Returns:
{Array} A day and time slot for the start of the event.

{Void} getEventsUserID(req, res, next)
Middleware function to get events from database that user with id userid is invited to. API to access this function: GET /api/events/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} getMatchedEventsUserID(req, res, next)
Middleware function to get events from database that user with id userid has been matched to. API to access this function: GET /api/matchedevents/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} getPendingEventsUserID(req, res, next)
Middleware function to get pending events from database that user with id userid has been matched to. API to access this function: GET /api/pendingevents/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} getUserID(req, res, next)
Middleware function to get user with id userid. API to access this function: GET /api/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} getUsers(req, res, next)
Middleware function to get array of JSON objects representing all users. API to access this function: GET /api/users
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Object} indexGet(req, res, next)
Function to handle GET requests for index page. Render the index page.
Defined in: index.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Void} insertEvent(properties, email, password, activity, startTime, endTime, location)
Function to insert a new event into the Events collection in MongoDB. The server returns a 404 error if the event in the request body is already in use. Otherwise it creates a new event with the given , and adds it to the MongoDB database, returning a 201 status code.
Defined in: database.js.
Parameters:
{Object} properties
JSON object containing the express router properties.
{string} email
The email of the new user.
{string} password
The password of the new user that is encrypted with bcrypt.
activity
startTime
endTime
location
Returns:
{Void}

{Void} insertUser(properties, name, email, password)
Function to insert a new user into the Users collection in MongoDB. The server returns a 404 error if the email in the request body is already in use. Otherwise it creates a new user with the given userID and hashed password, default availabilities, and no activities or events, and adds it to the MongoDB database, returning a 201 status code.
Defined in: database.js.
Parameters:
{Object} properties
JSON object containing the express router properties.
{string} name
The name of the new user.
{string} email
The email of the new user.
{string} password
The password of the new user that is encrypted with bcrypt.
Returns:
{Void}

{Object} loginGet(req, res)
Function to handle GET requests for login page. Render the registration page, and return it through res.
Defined in: login.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
Returns:
{Object} A JSON object that holds req and res.

{Object} loginPost(req, res)
Function to handle POST requests for login page. Causes the server to return 400 error if malformed request. Queries MongoDB for this user. If it doesn't exist, or the password doesn't match with cryptographic hash, then causes the server to return a 401 error, and redirects to login. If all goes well, then redirects user to her profile page with a JSON web token that lasts two hours.
Defined in: login.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose body contains the user's email and password.
{Object} res
The express routing HTTP client response object.
Returns:
{Object} A JSON object that holds req and res.

{Void} matchGet(req, res, next)
Middleware function to get matches for a user. API to access this function: GET /match/
Defined in: match.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Object} matchUser(curr_user, potential_match)
Compute a match score for two users.
Defined in: match.js.
Parameters:
{Object} curr_user
An object containing the user profile information for the logged in user.
{Object} potential_match
An object containing the user profile information for the the match candidate for the logged in user.
Returns:
{Object} An object conaining matched activity, event time, and score. A score representing how good the match is between the logged in user and the potential match. This match is based on availability, interest level, and skill level.

{!Array} matchUsers(req, res, next, userId, matches)
Key function to generate matches for a single user, given the user id.
Defined in: match.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
{number} userId
An integer that represents a user id.
matches
Returns:
{!Array} A sorted array of matching users, from highest score match to lowest score match.

{Void} postActivityUserID(req, res, next)
Middleware function to update an activity for user with id userid. API to access this function: POST /api/activity/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} postEvent(req, res, next)
Middleware function to post an event to the database. API to access this function: POST /api/event
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Object} profileGet(req, res, next)
Function to handle GET requests for user profile page. Render the profile page, or return a 404 error if the userID is not in the MongoDB database, or redirect to the login page with a 401 status code if the JSON web token does not verify.
Defined in: profile.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose parameters include the userID.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Void} putAvailabilityUserID(req, res, next)
Middleware function to update an availability cell for user with id userid. API to access this function: PUT /api/availability/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} putEventEventID(req, res, next)
Middleware function to update event in database with id eventId. API to access this function: PUT /api/event/:eventId
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} putNameUserID(req, res, next)
Middleware function to put a name into the user with id userid. API to access this function: PUT /api/name/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} putPasswordUserID(req, res, next)
Middleware function to update the password for user with id userid. API to access this function: PUT /api/password/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Void} putRateUserID(req, res, next)
Middleware function to let a user rate another user for an event. API to access this function: PUT /api/rate/:userid
Defined in: api.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Void}

{Object} registerGet(req, res, next)
Function to handle GET requests for user registration. Render the registration page, and return it through res.
Defined in: register.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose body contains the JSON object for user registration.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Object} registerPost(req, res, next)
Function to handle POST requests for user registration. Reject the registration iff the email, password, and confirmations fields are blank, or confirmation does not match. Otherwise add user to database.
Defined in: register.js.
Parameters:
{Object} req
The express routing HTTP client request object, whose body contains the JSON object for user registration.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Object} routerProperties(req, res, next)
Function to return a JSON object containing the express router properties.
Defined in: database.js.
Parameters:
{Object} req
The express routing HTTP client request object.
{Object} res
The express routing HTTP client response object.
{callback} next
The express routing callback function to invoke next middleware in the stack.
Returns:
{Object} A JSON object that holds req, res, and next.

{Void} searchUsers(properties, criteria, processUsers, processUsers)
Function to search for all users meeting a criteria. The server returns a 404 error if no users matching criteria are found.
Defined in: database.js.
Parameters:
{Object} properties
JSON object containing the express router properties.
{Object} criteria
JSON object to determine the search criteria for the user(s) we wish to find.
{callback} processUsers
A callback function to be invoked on the resulting set of users found.
processUsers
Returns:
{Void}

{Void} updateUser(properties, email, updateSet)
Function to return update a user's data in Users collection in MongoDB. The server returns a 404 error if unable to find a matching user in the database. Returns a 201 if it succesfully updates user data.
Defined in: database.js.
Parameters:
{Object} properties
JSON object containing the express router properties.
{string} email
The email of the user whose fields we wish to update.
{Object} updateSet
JSON object containing the data we wish to update.
Returns:
{Void}

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Dec 03 2018 11:03:13 GMT-0000 (GMT)