Add camelize & populate in Customer

This commit is contained in:
goga-m 2017-09-25 16:15:17 +03:00 committed by Josh Harvey
parent 3623e41302
commit e8f41c1427
3 changed files with 64 additions and 27 deletions

View file

@ -184,7 +184,7 @@ app.get('/api/customer/:id', (req, res, next) => {
})
/**
* Endpoint for patching customer's authorized_override status
* Endpoint for patching customer's authorizedOverride status
*
* Possible values: blocked, verified, automatic
*
@ -194,10 +194,10 @@ app.get('/api/customer/:id', (req, res, next) => {
* @param {function} next Callback
*/
app.patch('/api/customer/:id', (req, res, next) => {
if (!req.query.authorized_override) return res.status(400).send({Error: 'Requires authorized'})
if (!req.query.authorizedOverride) return res.status(400).send({Error: 'Requires authorized'})
return customers.patch(req.params.id, {
authorized_override: req.query.authorized_override
authorized_override: req.query.authorizedOverride
})
.then(r => res.send(r))
.catch(() => res.status(404).send({Error: 'Not found'}))