refactor: make deviceId its own variable

This commit is contained in:
siiky 2024-03-27 14:19:19 +00:00
parent f144c8a7cb
commit 08843ec73a

View file

@ -43,6 +43,7 @@ function updateCustomer (req, res, next) {
const patch = req.body
const triggers = configManager.getTriggers(req.settings.config)
const compatTriggers = complianceTriggers.getBackwardsCompatibleTriggers(triggers)
const deviceId = req.deviceId
if (patch.customRequestPatch) {
return updateCustomerCustomInfoRequest(id, patch.customRequestPatch, req, res).catch(next)
@ -61,7 +62,7 @@ function updateCustomer (req, res, next) {
return Promise.resolve({})
.then(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(newPatch => customers.updatePhotoCard(id, newPatch))