fix: overrides stuck on infinite loop if blocked
This commit is contained in:
parent
f19a2749ec
commit
c5b2c2daaa
1 changed files with 17 additions and 1 deletions
|
|
@ -72,7 +72,8 @@ function get (phone) {
|
||||||
function update (id, data, userToken, txId) {
|
function update (id, data, userToken, txId) {
|
||||||
const formattedData = _.omit(['id'], _.mapKeys(_.snakeCase, data))
|
const formattedData = _.omit(['id'], _.mapKeys(_.snakeCase, data))
|
||||||
|
|
||||||
const updateData = enhanceAtFields(enhanceOverrideFields(formattedData, userToken))
|
const enhancedUpdateData = enhanceAtFields(enhanceOverrideFields(formattedData, userToken))
|
||||||
|
const updateData = updateOverride(enhancedUpdateData)
|
||||||
|
|
||||||
const sql = Pgp.helpers.update(updateData, _.keys(updateData), 'customers') +
|
const sql = Pgp.helpers.update(updateData, _.keys(updateData), 'customers') +
|
||||||
' where id=$1 returning *'
|
' where id=$1 returning *'
|
||||||
|
|
@ -238,6 +239,21 @@ function getComplianceTypes () {
|
||||||
'us_ssn' ]
|
'us_ssn' ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateOverride (fields) {
|
||||||
|
const updateableFields = [
|
||||||
|
'id_card_data',
|
||||||
|
'id_card_photo',
|
||||||
|
'front_camera',
|
||||||
|
'authorized',
|
||||||
|
'us_ssn'
|
||||||
|
]
|
||||||
|
|
||||||
|
const updatedFields = _.intersection(updateableFields, _.keys(fields))
|
||||||
|
const atFields = _.fromPairs(_.map(f => [`${f}_override`, 'automatic'], updatedFields))
|
||||||
|
|
||||||
|
return _.merge(fields, atFields)
|
||||||
|
}
|
||||||
|
|
||||||
function enhanceAtFields (fields) {
|
function enhanceAtFields (fields) {
|
||||||
const updateableFields = [
|
const updateableFields = [
|
||||||
'id_card_data',
|
'id_card_data',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue