fix: send manually entered customer data to machine
This commit is contained in:
parent
c5bf50b932
commit
c2329be588
2 changed files with 11 additions and 11 deletions
|
|
@ -88,10 +88,7 @@ function update (id, data, userToken, txId) {
|
||||||
' where id=$1 returning *'
|
' where id=$1 returning *'
|
||||||
|
|
||||||
return db.one(sql, [id])
|
return db.one(sql, [id])
|
||||||
.then(customerData => {
|
.then(assignCustomerData)
|
||||||
return getEditedData(id)
|
|
||||||
.then(customerEditedData => selectLatestData(customerData, customerEditedData))
|
|
||||||
})
|
|
||||||
.then(addComplianceOverrides(id, updateData, userToken))
|
.then(addComplianceOverrides(id, updateData, userToken))
|
||||||
.then(populateOverrideUsernames)
|
.then(populateOverrideUsernames)
|
||||||
.then(computeStatus)
|
.then(computeStatus)
|
||||||
|
|
@ -324,6 +321,7 @@ function getById (id, userToken) {
|
||||||
.then(populateOverrideUsernames)
|
.then(populateOverrideUsernames)
|
||||||
.then(computeStatus)
|
.then(computeStatus)
|
||||||
.then(populateDailyVolume)
|
.then(populateDailyVolume)
|
||||||
|
.then(assignCustomerData)
|
||||||
.then(getCustomInfoRequestsData)
|
.then(getCustomInfoRequestsData)
|
||||||
.then(camelize)
|
.then(camelize)
|
||||||
}
|
}
|
||||||
|
|
@ -723,15 +721,18 @@ function getCustomerById (id) {
|
||||||
WHERE c.id = $2
|
WHERE c.id = $2
|
||||||
) AS cl WHERE rn = 1`
|
) AS cl WHERE rn = 1`
|
||||||
return db.oneOrNone(sql, [passableErrorCodes, id])
|
return db.oneOrNone(sql, [passableErrorCodes, id])
|
||||||
.then(customerData => {
|
.then(assignCustomerData)
|
||||||
return getEditedData(id)
|
|
||||||
.then(customerEditedData => selectLatestData(customerData, customerEditedData))
|
|
||||||
})
|
|
||||||
.then(populateOverrideUsernames)
|
.then(populateOverrideUsernames)
|
||||||
.then(camelize)
|
.then(camelize)
|
||||||
.then(it => ({ ...it, notes: (it.notes ?? []).map(camelize) }))
|
.then(it => ({ ...it, notes: (it.notes ?? []).map(camelize) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assignCustomerData (customer) {
|
||||||
|
return getEditedData(customer.id)
|
||||||
|
.then(customerEditedData => selectLatestData(customer, customerEditedData))
|
||||||
|
.then(_.assign(customer))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the specific customer manually edited data
|
* Query the specific customer manually edited data
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const _ = require('lodash/fp')
|
||||||
const compliance = require('../compliance')
|
const compliance = require('../compliance')
|
||||||
const complianceTriggers = require('../compliance-triggers')
|
const complianceTriggers = require('../compliance-triggers')
|
||||||
const configManager = require('../new-config-manager')
|
const configManager = require('../new-config-manager')
|
||||||
const { get, add, getEditedData, selectLatestData, getById, update } = require('../customers')
|
const { get, add, getById, update } = require('../customers')
|
||||||
const httpError = require('../route-helpers').httpError
|
const httpError = require('../route-helpers').httpError
|
||||||
const plugins = require('../plugins')
|
const plugins = require('../plugins')
|
||||||
const Tx = require('../tx')
|
const Tx = require('../tx')
|
||||||
|
|
@ -26,8 +26,7 @@ function addOrUpdateCustomer (req) {
|
||||||
|
|
||||||
return add(req.body)
|
return add(req.body)
|
||||||
})
|
})
|
||||||
.then(customer => Promise.all([getEditedData(customer.id), getById(customer.id, null)]))
|
.then(customer => getById(customer.id))
|
||||||
.then(([customerEditedData, customerOriginalData]) => selectLatestData(customerOriginalData, customerEditedData))
|
|
||||||
.then(customer => {
|
.then(customer => {
|
||||||
// BACKWARDS_COMPATIBILITY 7.5
|
// BACKWARDS_COMPATIBILITY 7.5
|
||||||
// machines before 7.5 expect customer with sanctions result
|
// machines before 7.5 expect customer with sanctions result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue