feat(server): sync Plaid transactions to uncategorized transactions

This commit is contained in:
Ahmed Bouhuolia
2024-03-04 13:42:17 +02:00
parent 9db03350e0
commit f23e8d98f6
10 changed files with 113 additions and 24 deletions

View File

@@ -4,10 +4,13 @@ import { UncategorizeCashflowTransaction } from './UncategorizeCashflowTransacti
import { CategorizeCashflowTransaction } from './CategorizeCashflowTransaction';
import {
CategorizeTransactionAsExpenseDTO,
CreateUncategorizedTransactionDTO,
ICategorizeCashflowTransactioDTO,
IUncategorizedCashflowTransaction,
} from '@/interfaces';
import { CategorizeTransactionAsExpense } from './CategorizeTransactionAsExpense';
import { GetUncategorizedTransactions } from './GetUncategorizedTransactions';
import { CreateUncategorizedTransaction } from './CreateUncategorizedTransaction';
@Service()
export class CashflowApplication {
@@ -26,6 +29,9 @@ export class CashflowApplication {
@Inject()
private getUncategorizedTransactionsService: GetUncategorizedTransactions;
@Inject()
private createUncategorizedTransactionService: CreateUncategorizedTransaction;
/**
* Deletes the given cashflow transaction.
* @param {number} tenantId
@@ -39,6 +45,22 @@ export class CashflowApplication {
);
}
/**
* Creates a new uncategorized cash transaction.
* @param {number} tenantId
* @param {CreateUncategorizedTransactionDTO} createUncategorizedTransactionDTO
* @returns {IUncategorizedCashflowTransaction}
*/
public createUncategorizedTransaction(
tenantId: number,
createUncategorizedTransactionDTO: CreateUncategorizedTransactionDTO
) {
return this.createUncategorizedTransactionService.create(
tenantId,
createUncategorizedTransactionDTO
);
}
/**
* Uncategorize the given cashflow transaction.
* @param {number} tenantId
@@ -98,7 +120,10 @@ export class CashflowApplication {
* @param {number} tenantId
* @returns {}
*/
public getUncategorizedTransactions(tenantId: number) {
return this.getUncategorizedTransactionsService.getTransactions(tenantId);
public getUncategorizedTransactions(tenantId: number, accountId: number) {
return this.getUncategorizedTransactionsService.getTransactions(
tenantId,
accountId
);
}
}