refactor: banking services to Nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-01-05 16:26:23 +02:00
parent b72f85b394
commit 1869ba216f
150 changed files with 9698 additions and 163 deletions

View File

@@ -0,0 +1,58 @@
import { Knex } from 'knex';
import { DeleteCashflowTransaction } from './commands/DeleteCashflowTransaction.service';
import { CreateBankTransactionService } from './commands/CreateBankTransaction.service';
import { GetBankTransactionService } from './queries/GetBankTransaction.service';
import { ICashflowNewCommandDTO } from './types/BankingTransactions.types';
import { Injectable } from '@nestjs/common';
@Injectable()
export class BankingTransactionsApplication {
constructor(
private readonly createTransactionService: CreateBankTransactionService,
private readonly deleteTransactionService: DeleteCashflowTransaction,
private readonly getCashflowTransactionService: GetBankTransactionService,
// private readonly getCashflowAccountsService: GetBankingAccountsServic,
) {}
/**
* Creates a new cashflow transaction.
* @param {ICashflowNewCommandDTO} transactionDTO
* @returns
*/
public createTransaction(transactionDTO: ICashflowNewCommandDTO) {
return this.createTransactionService.newCashflowTransaction(transactionDTO);
}
/**
* Deletes the given cashflow transaction.
* @param {number} cashflowTransactionId - Cashflow transaction id.
* @returns {Promise<{ oldCashflowTransaction: ICashflowTransaction }>}
*/
public deleteTransaction(cashflowTransactionId: number) {
return this.deleteTransactionService.deleteCashflowTransaction(
cashflowTransactionId,
);
}
/**
* Retrieves specific cashflow transaction.
* @param {number} cashflowTransactionId
* @returns
*/
public getTransaction(cashflowTransactionId: number) {
return this.getCashflowTransactionService.getBankTransaction(
cashflowTransactionId,
);
}
/**
* Retrieves the cashflow accounts.
* @param {ICashflowAccountsFilter} filterDTO
* @returns
*/
public getCashflowAccounts(
// filterDTO: ICashflowAccountsFilter,
) {
// return this.getCashflowAccountsService.getCashflowAccounts(filterDTO);
}
}