mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix: all sql queries should be under one transaction
This commit is contained in:
@@ -46,7 +46,7 @@ export class PlaidSyncDb {
|
|||||||
trx?: Knex.Transaction
|
trx?: Knex.Transaction
|
||||||
) {
|
) {
|
||||||
const { Account } = this.tenancy.models(tenantId);
|
const { Account } = this.tenancy.models(tenantId);
|
||||||
const plaidAccount = Account.query().findOne(
|
const plaidAccount = await Account.query().findOne(
|
||||||
'plaidAccountId',
|
'plaidAccountId',
|
||||||
createBankAccountDTO.plaidAccountId
|
createBankAccountDTO.plaidAccountId
|
||||||
);
|
);
|
||||||
@@ -101,11 +101,11 @@ export class PlaidSyncDb {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { Account } = this.tenancy.models(tenantId);
|
const { Account } = this.tenancy.models(tenantId);
|
||||||
|
|
||||||
const cashflowAccount = await Account.query()
|
const cashflowAccount = await Account.query(trx)
|
||||||
.findOne({ plaidAccountId })
|
.findOne({ plaidAccountId })
|
||||||
.throwIfNotFound();
|
.throwIfNotFound();
|
||||||
|
|
||||||
const openingEquityBalance = await Account.query().findOne(
|
const openingEquityBalance = await Account.query(trx).findOne(
|
||||||
'slug',
|
'slug',
|
||||||
'opening-balance-equity'
|
'opening-balance-equity'
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user