refator: delete unnecessary transaction
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-04 08:19:09 +02:00
parent a486b1593b
commit 5c76437498
2 changed files with 19 additions and 29 deletions

View File

@ -28,14 +28,8 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const query = const query =
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname `SELECT DISTINCT u.nickname
FROM itemType it FROM itemType it
JOIN worker w ON w.id = it.workerFk JOIN worker w ON w.id = it.workerFk
JOIN account.user u ON u.id = w.id`; JOIN account.user u ON u.id = w.id`;
@ -59,9 +53,5 @@ module.exports = Self => {
if (tx) await tx.commit(); if (tx) await tx.commit();
return conn.executeStmt(stmt); return conn.executeStmt(stmt);
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
}; };
}; };

View File

@ -16,6 +16,6 @@ describe('ticket-request getItemTypeWorker()', () => {
const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); const result = await models.TicketRequest.getItemTypeWorker(ctx, filter);
expect(result.length).toEqual(2); expect(result.length).toBeGreaterThan(1);
}); });
}); });