WIP
This commit is contained in:
parent
f7561acf3c
commit
80e851fb59
9 changed files with 131 additions and 76 deletions
|
|
@ -186,11 +186,14 @@ function getCustomerWithPhoneCode (req, res, next) {
|
|||
function updateCustomer (req, res, next) {
|
||||
const id = req.params.id
|
||||
const patch = req.body
|
||||
const config = configManager.unscoped(req.settings.config)
|
||||
|
||||
customers.getById(id)
|
||||
.then(customer => {
|
||||
if (!customer) { throw httpError('Not Found', 404) }
|
||||
return customers.update(id, patch)
|
||||
})
|
||||
.then(customer => customers.validate(config, customer))
|
||||
.then(customer => respond(req, res, {customer}))
|
||||
.catch(next)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue