From 2f0ca0ab2632c71d1d212f9fc903a05713cdbe99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Tue, 29 Jun 2021 09:31:20 +0100 Subject: [PATCH] fix: remove logs and change route --- lib/customers.js | 9 ++------- lib/routes/customerRoutes.js | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index 25a0db47..620ba49f 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -584,19 +584,14 @@ function updatePhotos (imagesData, id, dir) { } const newPatch = {} // i.e. ..////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. ..////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) diff --git a/lib/routes/customerRoutes.js b/lib/routes/customerRoutes.js index 2c92449c..510a6882 100644 --- a/lib/routes/customerRoutes.js +++ b/lib/routes/customerRoutes.js @@ -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