Module: services/UserService

Service to interact with User database

Source:

Methods

(inner) deleteItem(userid, field, value)

A generic function to delete an array element from a User attribute

Parameters:
Name Type Description
userid String

The id of the user object we want to modify

field Object

the specific field we want to push to

value Object

the value we want to push into the array

Source:

(inner) deleteUser(userid)

Delete specific user from mongoDB

Parameters:
Name Type Description
userid string

userId string from google login

Source:

(inner) findAllUsers() → {Document}

Gets all users from mongodb database

Source:
Returns:
  • Returns all user documents
Type
Document

(inner) getUser(userid) → {document}

Get user from mongodb database based on user id

Parameters:
Name Type Description
userid string

userid string from google login

Source:
Returns:
  • returns user document by ID field
Type
document

(inner) postUser(userBody) → {Promise}

Post new user to mongodb

Parameters:
Name Type Description
userBody Object

object representing user account

Source:
Returns:

– Promise document representing the user document in mongoDB database

Type
Promise

(inner) pushItem(userid, field, value)

A generic function to push an array element into any User attributes

Parameters:
Name Type Description
userid String

The id of the user object we want to modify

field Object

the specific field we want to push to

value Object

the value we want to push into the array

Source: