fix: override fields update
This commit is contained in:
parent
1913390eae
commit
a432d913be
3 changed files with 10 additions and 3 deletions
|
|
@ -97,7 +97,7 @@ function update (id, data, userToken, txId) {
|
|||
*
|
||||
* @returns {Promise} Newly updated Customer
|
||||
*/
|
||||
async function updateCustomer (id, data) {
|
||||
async function updateCustomer (id, data, userToken) {
|
||||
const formattedData = _.pick(
|
||||
[
|
||||
'authorized_override',
|
||||
|
|
@ -110,7 +110,10 @@ async function updateCustomer (id, data) {
|
|||
],
|
||||
_.mapKeys(_.snakeCase, data))
|
||||
|
||||
const sql = Pgp.helpers.update(formattedData, _.keys(formattedData), 'customers') +
|
||||
const enhancedUpdateData = enhanceAtFields(enhanceOverrideFields(formattedData, userToken))
|
||||
const updateData = updateOverride(enhancedUpdateData)
|
||||
|
||||
const sql = Pgp.helpers.update(updateData, _.keys(updateData), 'customers') +
|
||||
' where id=$1'
|
||||
|
||||
await db.none(sql, [id])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue