fix: remove logs and change route
This commit is contained in:
parent
c7d56c8110
commit
2f0ca0ab26
2 changed files with 3 additions and 8 deletions
|
|
@ -584,19 +584,14 @@ function updatePhotos (imagesData, id, dir) {
|
|||
}
|
||||
const newPatch = {}
|
||||
// i.e. ../<lamassu-server-home>/<operatorid>/<customerid>/idcarddata
|
||||
console.log(dir, 'directoryyyy')
|
||||
const dirname = path.join(dir)
|
||||
console.log(dirname, 'dirnaaaaaaaaaaaaaaame')
|
||||
// create the directory tree if needed
|
||||
_.attempt(() => makeDir.sync(dirname))
|
||||
const promises = imagesData.map((imageData, index) => {
|
||||
console.log(index)
|
||||
// decode the base64 string to binary data
|
||||
const decodedImageData = Buffer.from(imageData, 'base64')
|
||||
|
||||
// i.e. ../<lamassu-server-home>/<operatorid>/<customerid>/idcarddata/1.jpg
|
||||
const filename = path.join(dirname, index + '.jpg')
|
||||
|
||||
return writeFile(filename, decodedImageData)
|
||||
})
|
||||
|
||||
|
|
@ -617,8 +612,8 @@ function updatePhotos (imagesData, id, dir) {
|
|||
function updateIdCardData (patch, id) {
|
||||
/* TODO: fetch operator id */
|
||||
const operatorId = 'id-operator'
|
||||
const directory = operatorDataDir + '/' + operatorId + '/' + id + '/'
|
||||
console.log(directory)
|
||||
const directory = `${operatorDataDir}/${operatorId}/${id}/`
|
||||
|
||||
return Promise.resolve(patch)
|
||||
.then(patch => {
|
||||
const imagesData = _.get('photos', patch)
|
||||
|
|
|
|||
|
|
@ -103,6 +103,6 @@ router.patch('/:id', updateCustomer)
|
|||
router.patch('/:id/sanctions', triggerSanctions)
|
||||
router.patch('/:id/block', triggerBlock)
|
||||
router.patch('/:id/suspend', triggerSuspend)
|
||||
router.patch('/:id/dataphotos', updateIdCardData)
|
||||
router.patch('/:id/photos/idcarddata', updateIdCardData)
|
||||
|
||||
module.exports = router
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue