Module: user-list-dal

Methods

(static) changeActiveFlag(UserId, ListId, newState) → {Promise.<(Object|Error)>}

Changes the active bit of the association between user UserId and list ListId according to the provided newState.
Parameters:
Name Type Description
UserId int
ListId int
newState int
Source:
Returns:
Type
Promise.<(Object|Error)>

(static) create(ListId, UserId, updater, start_date, end_date, active) → {Promise.<(Object|Error)>}

Associate a user with a list, the parameters userId and listId represent the user id and the list id, the endDate determines when the association between that list and that user will expire and the active bit will turn into 0.
Parameters:
Name Type Description
ListId int
UserId int
updater int
start_date Date
end_date Date
active int
Source:
Returns:
Type
Promise.<(Object|Error)>

(static) delete(ListId, UserId) → {Promise.<{deletedRows: (Object|Error)}>}

Deletes the association between the specified user and list.
Parameters:
Name Type Description
ListId int
UserId int
Source:
Returns:
Type
Promise.<{deletedRows: (Object|Error)}>

(static) getByList(id) → {Promise.<(Object|Error)>}

Returns all associations of the list id.
Parameters:
Name Type Description
id int
Source:
Returns:
Type
Promise.<(Object|Error)>

(static) getByUser(UserId) → {Promise.<{end_date: *, active, id, list: *, user: *, start_date: *, updater}>}

Returns all associations of the user userId. Asks the database for all list entries that are active and associated with a specific user
Parameters:
Name Type Description
UserId int
Source:
Returns:
Type
Promise.<{end_date: *, active, id, list: *, user: *, start_date: *, updater}>

(static) getByUserId(id) → {Promise.<(Object|Error)>}

Returns the all associations of the user id.
Parameters:
Name Type Description
id int
Source:
Returns:
Type
Promise.<(Object|Error)>

(static) isUserBlackListed(UserId) → {Promise.<(Object|Error)>}

Returns a boolean saying if the user is currently associated with the blacklist.
Parameters:
Name Type Description
UserId int
Source:
Returns:
Type
Promise.<(Object|Error)>

(static) update(user, list, start_date, end_date, active, updater) → {Promise.<{end_date: *, active: *, updatedRows: (Object|Error), updater: *}>}

Changes the values of start_date, end_date, active and updater of the association between the user with id=user and the list with id=list.
Parameters:
Name Type Description
user int
list int
start_date Date
end_date Date
active int
updater int
Source:
Returns:
Type
Promise.<{end_date: *, active: *, updatedRows: (Object|Error), updater: *}>