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 models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
let tx;
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
try {
|
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
|
||||||
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
|
const updatedMdbApp = await mdbApp.updateAttributes({
|
||||||
const updatedMdbApp = await mdbApp.updateAttributes({
|
userFk: null,
|
||||||
userFk: null,
|
locked: null
|
||||||
locked: null
|
}, myOptions);
|
||||||
}, myOptions);
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
return updatedMdbApp;
|
||||||
|
|
||||||
return updatedMdbApp;
|
|
||||||
} catch (e) {
|
|
||||||
if (tx) await tx.rollback();
|
|
||||||
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue