Transaction
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-10-11 14:39:57 +02:00
parent d06492d367
commit b2e98c9d73
1 changed files with 4 additions and 2 deletions

View File

@ -17,16 +17,18 @@ module.exports = Self => {
});
Self.deleteTrashFiles = async options => {
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction)
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const tx = await Self.beginTransaction({});
if (process.env.NODE_ENV == 'test')
throw new UserError(`Action not allowed on the test environment`);