services/users

Service to create, update, and retrieve user information.

Methods

(static) delete(userId) → {Promise.<boolean>}

Delete user with provided ID.
Source:
Parameters:
Name Type Description
userId * The ID of the user to delete.
Throws:
- If the operation fails or encounters an error.
Type
Error
Returns:
Type:
Promise.<boolean>
- A promise that resolves to true if the user was successfully deleted, or false otherwise.

(static) getAll(offset, limit) → {Promise.<Array.<UserDTO>>}

Retrieve a paginated list of users.
Source:
Parameters:
Name Type Description
offset number The number of items to skip before starting to return results.
limit number The maximum number of items to return.
Throws:
- If the operation fails or encounters an error.
Type
Error
Returns:
Type:
Promise.<Array.<UserDTO>>
A promise that resolves to an object containing an array of UserDTO objects representing the users and the total count of users.

(static) getById(userId) → {Promise.<UserDTO>}

Retrieve details of a user.
Source:
Parameters:
Name Type Description
userId string The ID of the user to retrieve.
Throws:
- If the operation fails or encounters an error.
Type
Error
Returns:
Type:
Promise.<UserDTO>

(static) search(terms) → {Promise.<Array.<UserDTO>>}

Search for users based on the provided search terms.
Source:
Parameters:
Name Type Description
terms string The search terms to match against users first names, last names.
Throws:
- If the operation fails or encounters an error.
Type
Error
Returns:
Type:
Promise.<Array.<UserDTO>>
A promise that resolves to an array of User objects matching the search terms.

(static) update(userId, userUpdate) → {Promise.<boolean>}

Update user details with the provided data.
Source:
Parameters:
Name Type Description
userId string The ID of the user to update.
userUpdate * The updated data for the user.
Throws:
- If the operation fails or encounters an error.
Type
Error
Returns:
Type:
Promise.<boolean>
- A promise that resolves to true if the user was successfully updated, or false otherwise.