refactor(sales): transaction correctly passed to findById

This commit is contained in:
Carlos Jimenez Ruiz 2021-10-14 16:16:00 +02:00
parent ce5a29496e
commit 35a2a71602
2 changed files with 13 additions and 5 deletions

View File

@ -170,7 +170,7 @@ module.exports = Self => {
// Update original sale
const rest = originalSale.quantity - sale.quantity;
const originalInstance = await models.Sale.findById(sale.id, options);
const originalInstance = await models.Sale.findById(sale.id, null, options);
await originalInstance.updateAttribute('quantity', rest, options);
// Clone sale with new quantity

16
package-lock.json generated
View File

@ -5655,6 +5655,7 @@
},
"node_modules/devtools-protocol": {
"version": "0.0.847576",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.847576.tgz",
"integrity": "sha512-0M8kobnSQE0Jmly7Mhbeq0W/PpZfnuK+WjN2ZRVPbGqYwCHCioAVp84H0TcLimgECcN5H976y5QiXMGBC9JKmg=="
},
"node_modules/diff": {
@ -16896,6 +16897,7 @@
},
"node_modules/puppeteer": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-7.1.0.tgz",
"integrity": "sha512-lqOLzqCKdh7yUAHvK6LxgOpQrL8Bv1/jvS8MLDXxcNms2rlM3E8p/Wlwc7efbRZ0twxTzUeqjN5EqrTwxOwc9g==",
"hasInstallScript": true,
"dependencies": {
@ -21105,8 +21107,9 @@
}
},
"node_modules/unbzip2-stream": {
"version": "1.4.3",
"integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz",
"integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==",
"dependencies": {
"buffer": "^5.2.1",
"through": "^2.3.8"
@ -21114,6 +21117,7 @@
},
"node_modules/unbzip2-stream/node_modules/buffer": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
"funding": [
{
@ -27925,6 +27929,7 @@
},
"devtools-protocol": {
"version": "0.0.847576",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.847576.tgz",
"integrity": "sha512-0M8kobnSQE0Jmly7Mhbeq0W/PpZfnuK+WjN2ZRVPbGqYwCHCioAVp84H0TcLimgECcN5H976y5QiXMGBC9JKmg=="
},
"diff": {
@ -36716,6 +36721,7 @@
},
"puppeteer": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-7.1.0.tgz",
"integrity": "sha512-lqOLzqCKdh7yUAHvK6LxgOpQrL8Bv1/jvS8MLDXxcNms2rlM3E8p/Wlwc7efbRZ0twxTzUeqjN5EqrTwxOwc9g==",
"requires": {
"debug": "^4.1.0",
@ -40017,8 +40023,9 @@
}
},
"unbzip2-stream": {
"version": "1.4.3",
"integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz",
"integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==",
"requires": {
"buffer": "^5.2.1",
"through": "^2.3.8"
@ -40026,6 +40033,7 @@
"dependencies": {
"buffer": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
"requires": {
"base64-js": "^1.3.1",