mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
33 lines
914 B
TypeScript
33 lines
914 B
TypeScript
import { Inject, Service } from 'typedi';
|
|
import PromisePool from '@supercharge/promise-pool';
|
|
import { castArray } from 'lodash';
|
|
import { ExcludeBankTransaction } from './ExcludeBankTransaction';
|
|
|
|
@Service()
|
|
export class ExcludeBankTransactions {
|
|
@Inject()
|
|
private excludeBankTransaction: ExcludeBankTransaction;
|
|
|
|
/**
|
|
* Exclude bank transactions in bulk.
|
|
* @param {number} tenantId
|
|
* @param {number} bankTransactionIds
|
|
* @returns {Promise<void>}
|
|
*/
|
|
public async excludeBankTransactions(
|
|
tenantId: number,
|
|
bankTransactionIds: Array<number> | number
|
|
) {
|
|
const _bankTransactionIds = castArray(bankTransactionIds);
|
|
|
|
await PromisePool.withConcurrency(1)
|
|
.for(_bankTransactionIds)
|
|
.process((bankTransactionId: number) => {
|
|
return this.excludeBankTransaction.excludeBankTransaction(
|
|
tenantId,
|
|
bankTransactionId
|
|
);
|
|
});
|
|
}
|
|
}
|