Skip to content

Commit

Permalink
fix: all sql queries should be under one transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Jun 6, 2024
1 parent 494d2c1 commit 3dadbea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/server/src/services/Banking/Plaid/PlaidSyncDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PlaidSyncDb {
trx?: Knex.Transaction
) {
const { Account } = this.tenancy.models(tenantId);
const plaidAccount = Account.query().findOne(
const plaidAccount = await Account.query().findOne(
'plaidAccountId',
createBankAccountDTO.plaidAccountId
);
Expand Down Expand Up @@ -101,11 +101,11 @@ export class PlaidSyncDb {
): Promise<void> {
const { Account } = this.tenancy.models(tenantId);

const cashflowAccount = await Account.query()
const cashflowAccount = await Account.query(trx)
.findOne({ plaidAccountId })
.throwIfNotFound();

const openingEquityBalance = await Account.query().findOne(
const openingEquityBalance = await Account.query(trx).findOne(
'slug',
'opening-balance-equity'
);
Expand Down

0 comments on commit 3dadbea

Please sign in to comment.