feat(server): change the Plaid synced bank name.

This commit is contained in:
Ahmed Bouhuolia
2024-03-05 16:36:35 +02:00
parent b602f28696
commit db839137d0
4 changed files with 75 additions and 23 deletions

View File

@@ -2,8 +2,6 @@ import * as R from 'ramda';
import {
CreateUncategorizedTransactionDTO,
IAccountCreateDTO,
ICashflowNewCommandDTO,
IUncategorizedCashflowTransaction,
PlaidAccount,
PlaidTransaction,
} from '@/interfaces';
@@ -13,21 +11,21 @@ import {
* @param {PlaidAccount} plaidAccount
* @returns {IAccountCreateDTO}
*/
export const transformPlaidAccountToCreateAccount = (
plaidAccount: PlaidAccount
): IAccountCreateDTO => {
return {
name: plaidAccount.name,
code: '',
description: plaidAccount.official_name,
currencyCode: plaidAccount.balances.iso_currency_code,
accountType: 'cash',
active: true,
plaidAccountId: plaidAccount.account_id,
bankBalance: plaidAccount.balances.current,
accountMask: plaidAccount.mask,
};
};
export const transformPlaidAccountToCreateAccount = R.curry(
(institution: any, plaidAccount: PlaidAccount): IAccountCreateDTO => {
return {
name: `${institution.name} - ${plaidAccount.name}`,
code: '',
description: plaidAccount.official_name,
currencyCode: plaidAccount.balances.iso_currency_code,
accountType: 'cash',
active: true,
plaidAccountId: plaidAccount.account_id,
bankBalance: plaidAccount.balances.current,
accountMask: plaidAccount.mask,
};
}
);
/**
* Transformes the plaid transaction to cashflow create DTO.