refactor: delete transaction
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
4e8896202a
commit
1a616fa1d4
|
@ -26,25 +26,15 @@ module.exports = Self => {
|
|||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
let tx;
|
||||
|
||||
if (typeof options == 'object')
|
||||
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,
|
||||
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