3092-module_transactions #740
|
@ -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();
|
||||
|
|
|
@ -96,6 +96,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return addedDms;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
|
|
@ -151,6 +151,7 @@ module.exports = Self => {
|
|||
await fs.unlink(srcFilePath);
|
||||
|
||||
await tx.commit();
|
||||
|
||||
return newImage;
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue