Namespace: UserService

UserService

A service that handles CRUD operations on users and picture uploads.
Source:

Methods

(static) create(user) → {Promise.<User>}

Create a user
Parameters:
Name Type Description
user Object the user object to create
Source:
Returns:
Promise that eventually creates and resolves a user or throws error
Type
Promise.<User>

(static) del(userId) → {Promise}

Deletes a single user
Parameters:
Name Type Description
userId String the ID of the user
Source:
Returns:
Promise that eventually deletes a user or throws error
Type
Promise

(static) getProfilePicture(userId) → {Buffer}

Retrieve the profile picture for the user
Parameters:
Name Type Description
userId String the userId folder path where to look for the picture
Source:
Returns:
the profile picture
Type
Buffer

(static) list() → {Promise.<Array.<Card>>}

List all users
Source:
Returns:
Promise that eventually resolves an array of users or throws error
Type
Promise.<Array.<Card>>

(static) modifyProfilePicture(user, files) → {Buffer}

Upload a picture for the user
Parameters:
Name Type Description
user Object the user to which picture needs to be added
files Object the userId folder path where to look for the picture
Properties
Name Type Description
path String the path where the temporary picture is currently stored
Source:
Returns:
the profile picture
Type
Buffer

(static) read(userId) → {Promise.<User>}

Retrieves a single user by ID
Parameters:
Name Type Description
userId String the ID of the user
Source:
Returns:
Promise that eventually resolves a user or throws error
Type
Promise.<User>

(static) stripSensitiveInformation(user) → {Object}

Removes sensitive information from the user object
Parameters:
Name Type Description
user Object the user object to be stripped
Source:
Returns:
the stripped user object
Type
Object

(static) update(userId, body) → {Promise.<User>}

Updates a single user
Parameters:
Name Type Description
userId String the ID of the user
body Object key/value pairs of the fields that should be changed
Source:
Returns:
Promise that eventually updates and resolves a user or throws error
Type
Promise.<User>