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 *'
|
||||
|
||||
return db.one(sql, [id])
|
||||
.then(customerData => {
|
||||
return getEditedData(id)
|
||||
.then(customerEditedData => selectLatestData(customerData, customerEditedData))
|
||||
})
|
||||
.then(assignCustomerData)
|
||||
.then(addComplianceOverrides(id, updateData, userToken))
|
||||
.then(populateOverrideUsernames)
|
||||
.then(computeStatus)
|
||||
|
|
@ -324,6 +321,7 @@ function getById (id, userToken) {
|
|||
.then(populateOverrideUsernames)
|
||||
.then(computeStatus)
|
||||
.then(populateDailyVolume)
|
||||
.then(assignCustomerData)
|
||||
.then(getCustomInfoRequestsData)
|
||||
.then(camelize)
|
||||
}
|
||||
|
|
@ -723,15 +721,18 @@ function getCustomerById (id) {
|
|||
WHERE c.id = $2
|
||||
) AS cl WHERE rn = 1`
|
||||
return db.oneOrNone(sql, [passableErrorCodes, id])
|
||||
.then(customerData => {
|
||||
return getEditedData(id)
|
||||
.then(customerEditedData => selectLatestData(customerData, customerEditedData))
|
||||
})
|
||||
.then(assignCustomerData)
|
||||
.then(populateOverrideUsernames)
|
||||
.then(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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const _ = require('lodash/fp')
|
|||
const compliance = require('../compliance')
|
||||
const complianceTriggers = require('../compliance-triggers')
|
||||
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 plugins = require('../plugins')
|
||||
const Tx = require('../tx')
|
||||
|
|
@ -26,8 +26,7 @@ function addOrUpdateCustomer (req) {
|
|||
|
||||
return add(req.body)
|
||||
})
|
||||
.then(customer => Promise.all([getEditedData(customer.id), getById(customer.id, null)]))
|
||||
.then(([customerEditedData, customerOriginalData]) => selectLatestData(customerOriginalData, customerEditedData))
|
||||
.then(customer => getById(customer.id))
|
||||
.then(customer => {
|
||||
// BACKWARDS_COMPATIBILITY 7.5
|
||||
// machines before 7.5 expect customer with sanctions result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue