diff --git a/packages/server/src/services/Banking/Exclude/UnexcludeBankTransaction.ts b/packages/server/src/services/Banking/Exclude/UnexcludeBankTransaction.ts index bfa6ebb67..46bd81862 100644 --- a/packages/server/src/services/Banking/Exclude/UnexcludeBankTransaction.ts +++ b/packages/server/src/services/Banking/Exclude/UnexcludeBankTransaction.ts @@ -29,7 +29,7 @@ export class UnexcludeBankTransaction { public async unexcludeBankTransaction( tenantId: number, uncategorizedTransactionId: number - ) { + ): Promise { const { UncategorizedCashflowTransaction } = this.tenancy.models(tenantId); const oldUncategorizedTransaction = @@ -40,10 +40,13 @@ export class UnexcludeBankTransaction { validateTransactionNotCategorized(oldUncategorizedTransaction); return this.uow.withTransaction(tenantId, async (trx) => { - await this.eventPublisher.emitAsync(events.bankTransactions.onExcluding, { - tenantId, - uncategorizedTransactionId, - } as IBankTransactionExcludingEventPayload); + await this.eventPublisher.emitAsync( + events.bankTransactions.onUnexcluding, + { + tenantId, + uncategorizedTransactionId, + } as IBankTransactionExcludingEventPayload + ); await UncategorizedCashflowTransaction.query(trx) .findById(uncategorizedTransactionId) @@ -51,10 +54,13 @@ export class UnexcludeBankTransaction { excludedAt: null, }); - await this.eventPublisher.emitAsync(events.bankTransactions.onExcluded, { - tenantId, - uncategorizedTransactionId, - } as IBankTransactionExcludedEventPayload); + await this.eventPublisher.emitAsync( + events.bankTransactions.onUnexcluded, + { + tenantId, + uncategorizedTransactionId, + } as IBankTransactionExcludedEventPayload + ); }); } } diff --git a/packages/server/src/subscribers/events.ts b/packages/server/src/subscribers/events.ts index e4c60d537..b254c7113 100644 --- a/packages/server/src/subscribers/events.ts +++ b/packages/server/src/subscribers/events.ts @@ -644,7 +644,7 @@ export default { onExcluding: 'onBankTransactionExclude', onExcluded: 'onBankTransactionExcluded', - onUnexcluding: 'onBankTransactionExcluding', - onUnexcluded: 'onBankTransactionExcluded', + onUnexcluding: 'onBankTransactionUnexcluding', + onUnexcluded: 'onBankTransactionUnexcluded', }, };