Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4856-worker.time-control
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
1693907ee0
|
@ -131,7 +131,7 @@ module.exports = Self => {
|
||||||
WHERE u.id = ?`, [userId], options);
|
WHERE u.id = ?`, [userId], options);
|
||||||
|
|
||||||
let roles = [];
|
let roles = [];
|
||||||
for (role of result)
|
for (const role of result)
|
||||||
roles.push(role.name);
|
roles.push(role.name);
|
||||||
|
|
||||||
return roles;
|
return roles;
|
||||||
|
|
|
@ -65,7 +65,7 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
await fs.access(file.path);
|
await fs.access(file.path);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await Self.createPdf(ctx, id);
|
await Self.createPdf(ctx, id, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const stream = fs.createReadStream(file.path);
|
const stream = fs.createReadStream(file.path);
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
|
|
||||||
describe('InvoiceOut downloadZip()', () => {
|
|
||||||
const userId = 9;
|
|
||||||
const invoiceIds = '1,2';
|
|
||||||
const ctx = {
|
|
||||||
req: {
|
|
||||||
|
|
||||||
accessToken: {userId: userId},
|
|
||||||
headers: {origin: 'http://localhost:5000'},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
it('should return part of link to dowloand the zip', async() => {
|
|
||||||
const tx = await models.InvoiceOut.beginTransaction({});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
|
|
||||||
const result = await models.InvoiceOut.downloadZip(ctx, invoiceIds, options);
|
|
||||||
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return an error if the size of the files is too large', async() => {
|
|
||||||
const tx = await models.InvoiceOut.beginTransaction({});
|
|
||||||
|
|
||||||
let error;
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
const zipConfig = {
|
|
||||||
maxSize: 0
|
|
||||||
};
|
|
||||||
await models.ZipConfig.create(zipConfig, options);
|
|
||||||
|
|
||||||
await models.InvoiceOut.downloadZip(ctx, invoiceIds, options);
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(error).toEqual(new UserError(`Files are too large`));
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -22,6 +22,7 @@ module.exports = {
|
||||||
this.labelsData = await this.rawSqlFromDef('labelData', this.id);
|
this.labelsData = await this.rawSqlFromDef('labelData', this.id);
|
||||||
this.username = await this.findOneFromDef('username', this.userFk);
|
this.username = await this.findOneFromDef('username', this.userFk);
|
||||||
this.labelData = this.labelsData[0];
|
this.labelData = this.labelsData[0];
|
||||||
|
this.checkMainEntity(this.labelData);
|
||||||
|
|
||||||
let QRdata = JSON.stringify({
|
let QRdata = JSON.stringify({
|
||||||
company: 'vnl',
|
company: 'vnl',
|
||||||
|
@ -32,7 +33,6 @@ module.exports = {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.QR = await this.getQR(QRdata);
|
this.QR = await this.getQR(QRdata);
|
||||||
this.checkMainEntity(this.labelsData);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getQR(id) {
|
getQR(id) {
|
||||||
|
|
Loading…
Reference in New Issue