fix: remove user_tokens from _override_by customer fields
This commit is contained in:
parent
1bc944386b
commit
eb91d882c7
2 changed files with 7 additions and 7 deletions
|
|
@ -399,7 +399,7 @@ function computeStatus (customer) {
|
|||
function populateOverrideUsernames (customer) {
|
||||
const fieldsToUpdate = _.map(field => {
|
||||
return {
|
||||
token: customer[field + '_override_by'],
|
||||
token: customer[field + '_override_by'] || customer[field + '_override_by_old'],
|
||||
field: field + '_override_by_name'
|
||||
}
|
||||
}, getComplianceTypes())
|
||||
|
|
|
|||
12
lib/users.js
12
lib/users.js
|
|
@ -22,19 +22,19 @@ function get (token) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get multiple users given an array of tokens
|
||||
* Get multiple users given an array of ids
|
||||
*
|
||||
* @name getByIds
|
||||
* @function
|
||||
*
|
||||
* @param {array} tokens Array with users' tokens
|
||||
* @param {array} ids Array with users' ids
|
||||
*
|
||||
* @returns {array} Array of users found
|
||||
*/
|
||||
function getByIds (tokens) {
|
||||
const sql = 'SELECT * FROM user_tokens WHERE token IN ($1^)'
|
||||
const tokensClause = _.map(pgp.as.text, tokens).join(',')
|
||||
return db.any(sql, [tokensClause])
|
||||
function getByIds (ids) {
|
||||
const sql = `SELECT * FROM users WHERE id IN ($1^)`
|
||||
const idList = _.map(pgp.as.text, ids).join(',')
|
||||
return db.any(sql, [idList])
|
||||
}
|
||||
|
||||
function getUsers () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue