4794-mdb_block #1170
|
@ -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
|
||||
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
joan
commented
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;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Llevar tot lo referent a tx i try-catch