refactor: make deviceId its own variable
This commit is contained in:
parent
f144c8a7cb
commit
08843ec73a
1 changed files with 2 additions and 1 deletions
|
|
@ -43,6 +43,7 @@ function updateCustomer (req, res, next) {
|
||||||
const patch = req.body
|
const patch = req.body
|
||||||
const triggers = configManager.getTriggers(req.settings.config)
|
const triggers = configManager.getTriggers(req.settings.config)
|
||||||
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers)
|
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers)
|
||||||
|
const deviceId = req.deviceId
|
||||||
|
|
||||||
if (patch.customRequestPatch) {
|
if (patch.customRequestPatch) {
|
||||||
return updateCustomerCustomInfoRequest(id, patch.customRequestPatch, req, res).catch(next)
|
return updateCustomerCustomInfoRequest(id, patch.customRequestPatch, req, res).catch(next)
|
||||||
|
|
@ -61,7 +62,7 @@ function updateCustomer (req, res, next) {
|
||||||
return Promise.resolve({})
|
return Promise.resolve({})
|
||||||
.then(emptyObj => {
|
.then(emptyObj => {
|
||||||
if (!isOlderMachineVersion) return Promise.resolve(emptyObj)
|
if (!isOlderMachineVersion) return Promise.resolve(emptyObj)
|
||||||
return compliance.validationPatch(req.deviceId, !!compatTriggers.sanctions, mergedCustomer)
|
return compliance.validationPatch(deviceId, !!compatTriggers.sanctions, mergedCustomer)
|
||||||
})
|
})
|
||||||
.then(_.merge(patch))
|
.then(_.merge(patch))
|
||||||
.then(newPatch => customers.updatePhotoCard(id, newPatch))
|
.then(newPatch => customers.updatePhotoCard(id, newPatch))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue