feat: relay id data photos to server

This commit is contained in:
José Oliveira 2021-03-17 13:53:20 +00:00 committed by Josh Harvey
parent 04e583b47d
commit c221437618
5 changed files with 94 additions and 3 deletions

View file

@ -43,6 +43,19 @@ function updateCustomer (req, res, next) {
.catch(next)
}
function updateIdCardData (req, res, next) {
const id = req.params.id
const patch = req.body
customers.getById(id)
.then(customer => {
if (!customer) { throw httpError('Not Found', 404) }
return customers.updateIdCardData(patch, id)
.then(() => customer)
})
.then(customer => respond(req, res, { customer }))
.catch(next)
}
function triggerSanctions (req, res, next) {
const id = req.params.id
@ -90,5 +103,6 @@ router.patch('/:id', updateCustomer)
router.patch('/:id/sanctions', triggerSanctions)
router.patch('/:id/block', triggerBlock)
router.patch('/:id/suspend', triggerSuspend)
router.patch('/:id/cardphotos', updateIdCardData)
module.exports = router