Restricted to itemFk
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-07-13 14:13:21 +02:00
parent ccc5b95b48
commit ee19ea2993
1 changed files with 6 additions and 4 deletions

View File

@ -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;
};
};