3092-module_transactions #740

Merged
joan merged 41 commits from 3092-module_transactions into dev 2021-10-18 07:42:24 +00:00
7 changed files with 6 additions and 3 deletions
Showing only changes of commit c4c1aa929a - Show all commits

View File

@ -89,6 +89,7 @@ module.exports = Self => {
await uploadNewFile(ctx, dms, myOptions);
if (tx) await tx.commit();
return dms;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -96,6 +96,7 @@ module.exports = Self => {
}
if (tx) await tx.commit();
return addedDms;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -151,6 +151,7 @@ module.exports = Self => {
await fs.unlink(srcFilePath);
await tx.commit();
return newImage;
} catch (e) {
await tx.rollback();

View File

@ -41,6 +41,7 @@ module.exports = Self => {
const deleted = await Promise.all(promises);
if (tx) await tx.commit();
return deleted;
} catch (e) {
if (tx) await tx.rollback();

View File

@ -97,6 +97,7 @@ module.exports = Self => {
const sql = ParameterizedSQL.join(stmts, ';');
await conn.executeStmt(sql, myOptions);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();

View File

@ -117,9 +117,6 @@ module.exports = Self => {
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk)
throw new UserError(`You don't have privileges to change the zone`);
}
const observationTypeDelivery = await models.ObservationType.findOne({
where: {code: 'delivery'}
}, myOptions);
const originalTicket = await models.Ticket.findOne({
where: {id: args.id},

View File

@ -70,6 +70,7 @@ module.exports = Self => {
await models.ZoneIncluded.create(newIncludedGeo, myOptions);
await models.ZoneEvent.create(newCalendarDays, myOptions);
if (tx) await tx.commit();
return newZone;