From ee19ea299337720073c0369d44ce3bb63c32ea60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Mon, 13 Jul 2020 14:13:21 +0200 Subject: [PATCH] Restricted to itemFk --- modules/item/back/methods/item-image-queue/download.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/item/back/methods/item-image-queue/download.js b/modules/item/back/methods/item-image-queue/download.js index c642a53b4..74954a6d1 100644 --- a/modules/item/back/methods/item-image-queue/download.js +++ b/modules/item/back/methods/item-image-queue/download.js @@ -7,7 +7,7 @@ module.exports = Self => { description: 'Returns last entries', accessType: 'WRITE', returns: { - type: 'Boolean', + type: ['Object'], root: true }, http: { @@ -21,7 +21,9 @@ module.exports = Self => { try { const imageQueue = await Self.find({ - limit: 2 + where: { + itemFk: 410421 + } }); // const rootPath = 'C:\\Users\\jsanc\\Desktop\\images'; @@ -32,7 +34,7 @@ module.exports = Self => { await fs.mkdir(tempPath); for (let image of imageQueue) { - const fileName = `${image.itemFk}.jpg`; + const fileName = `${image.itemFk}.png`; const filePath = path.join(tempPath, fileName); https.get(image.url, async response => { @@ -49,6 +51,6 @@ module.exports = Self => { throw e; } - return true; + return imageQueue; }; };