4794-mdb_block #1170

Merged
vicent merged 17 commits from 4794-mdb_block into dev 2022-12-22 09:19:16 +00:00
1 changed files with 6 additions and 16 deletions
Showing only changes of commit 1a616fa1d4 - Show all commits

View File

@ -26,25 +26,15 @@ module.exports = Self => {
const models = Self.app.models;
const myOptions = {};
let tx;
if (typeof options == 'object')
vicent marked this conversation as resolved
Review

Llevar tot lo referent a tx i try-catch

Llevar tot lo referent a tx i try-catch
Object.assign(myOptions, options);
try {
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
const updatedMdbApp = await mdbApp.updateAttributes({
userFk: null,
locked: null
}, myOptions);
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
const updatedMdbApp = await mdbApp.updateAttributes({
userFk: null,
vicent marked this conversation as resolved Outdated
Outdated
Review

En este caso no es necesario transaccionar si no se te pasa una transacción

En este caso no es necesario transaccionar si no se te pasa una transacción
locked: null
}, myOptions);
if (tx) await tx.commit();
return updatedMdbApp;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
return updatedMdbApp;
};
};