feat: recognize uncategorized transactions

This commit is contained in:
Ahmed Bouhuolia
2024-06-18 21:43:54 +02:00
parent 906835c396
commit 0b5cee070a
17 changed files with 234 additions and 37 deletions

View File

@@ -1,9 +1,9 @@
import { Knex } from 'knex';
import { Inject, Service } from 'typedi';
import { EventPublisher } from '@/lib/EventPublisher/EventPublisher';
import HasTenancyService from '@/services/Tenancy/TenancyService';
import UnitOfWork from '@/services/UnitOfWork';
import events from '@/subscribers/events';
import { Inject, Service } from 'typedi';
import {
IBankRuleEventEditedPayload,
IBankRuleEventEditingPayload,
@@ -56,6 +56,7 @@ export class EditBankRuleService {
async (trx?: Knex.Transaction) => {
// Triggers `onBankRuleEditing` event.
await this.eventPublisher.emitAsync(events.bankRules.onEditing, {
tenantId,
oldBankRule,
ruleId,
editRuleDTO,
@@ -63,12 +64,13 @@ export class EditBankRuleService {
} as IBankRuleEventEditingPayload);
// Updates the given bank rule.
await BankRule.query()
await BankRule.query(trx)
.findById(ruleId)
.patch({ ...tranformDTO });
// Triggers `onBankRuleEdited` event.
await this.eventPublisher.emitAsync(events.bankRules.onEdited, {
tenantId,
oldBankRule,
ruleId,
editRuleDTO,