mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
Merge pull request #902 from bigcapitalhq/fix-bank-transactions-unexclude2
fix(webapp): unexclude bank transactions
This commit is contained in:
@@ -4,8 +4,8 @@ import {
|
|||||||
validateTransactionShouldBeExcluded,
|
validateTransactionShouldBeExcluded,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import {
|
import {
|
||||||
IBankTransactionExcludedEventPayload,
|
IBankTransactionUnexcludedEventPayload,
|
||||||
IBankTransactionExcludingEventPayload,
|
IBankTransactionUnexcludingEventPayload,
|
||||||
} from '../types/BankTransactionsExclude.types';
|
} from '../types/BankTransactionsExclude.types';
|
||||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
@@ -50,7 +50,8 @@ export class UnexcludeBankTransactionService {
|
|||||||
return this.uow.withTransaction(async (trx: Knex.Transaction) => {
|
return this.uow.withTransaction(async (trx: Knex.Transaction) => {
|
||||||
await this.eventEmitter.emitAsync(events.bankTransactions.onUnexcluding, {
|
await this.eventEmitter.emitAsync(events.bankTransactions.onUnexcluding, {
|
||||||
uncategorizedTransactionId,
|
uncategorizedTransactionId,
|
||||||
} as IBankTransactionExcludingEventPayload);
|
trx,
|
||||||
|
} as IBankTransactionUnexcludingEventPayload);
|
||||||
|
|
||||||
await this.uncategorizedBankTransactionModel()
|
await this.uncategorizedBankTransactionModel()
|
||||||
.query(trx)
|
.query(trx)
|
||||||
@@ -61,7 +62,8 @@ export class UnexcludeBankTransactionService {
|
|||||||
|
|
||||||
await this.eventEmitter.emitAsync(events.bankTransactions.onUnexcluded, {
|
await this.eventEmitter.emitAsync(events.bankTransactions.onUnexcluded, {
|
||||||
uncategorizedTransactionId,
|
uncategorizedTransactionId,
|
||||||
} as IBankTransactionExcludedEventPayload);
|
trx,
|
||||||
|
} as IBankTransactionUnexcludedEventPayload);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export class DecrementUncategorizedTransactionOnExclude {
|
|||||||
trx,
|
trx,
|
||||||
}: IBankTransactionUnexcludedEventPayload) {
|
}: IBankTransactionUnexcludedEventPayload) {
|
||||||
const transaction = await this.uncategorizedBankTransaction()
|
const transaction = await this.uncategorizedBankTransaction()
|
||||||
.query()
|
.query(trx)
|
||||||
.findById(uncategorizedTransactionId);
|
.findById(uncategorizedTransactionId);
|
||||||
//
|
//
|
||||||
await this.account()
|
await this.account()
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ export function useUnexcludeUncategorizedTransactions(
|
|||||||
UnexcludeBankTransactionsValue
|
UnexcludeBankTransactionsValue
|
||||||
>(
|
>(
|
||||||
(value: { ids: Array<number | string> }) =>
|
(value: { ids: Array<number | string> }) =>
|
||||||
apiRequest.delete(`/banking/exclude/bulk`, { ids: value.ids }),
|
apiRequest.delete(`/banking/exclude/bulk`, { data: { ids: value.ids } }),
|
||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
onValidateExcludeUncategorizedTransaction(queryClient);
|
onValidateExcludeUncategorizedTransaction(queryClient);
|
||||||
|
|||||||
Reference in New Issue
Block a user