feat: add bank balance column to account

This commit is contained in:
Ahmed Bouhuolia
2024-02-04 22:16:03 +02:00
parent 6d888060d3
commit 2e0b3d0d5e
8 changed files with 38 additions and 8 deletions

View File

@@ -13,7 +13,7 @@ export class AccountTransformer extends Transformer {
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return ['formattedAmount', 'flattenName'];
return ['formattedAmount', 'flattenName', 'bankBalanceFormatted'];
};
/**
@@ -41,6 +41,17 @@ export class AccountTransformer extends Transformer {
return formatNumber(account.amount, { currencyCode: account.currencyCode });
};
/**
* Retrieves the formatted bank balance.
* @param {IAccount} account
* @returns {string}
*/
protected bankBalanceFormatted = (account: IAccount): string => {
return formatNumber(account.bankBalance, {
currencyCode: account.currencyCode,
});
};
/**
* Transformes the accounts collection to flat or nested array.
* @param {IAccount[]}