mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
add server to monorepo.
This commit is contained in:
41
packages/server/src/services/Contacts/ContactTransformer.ts
Normal file
41
packages/server/src/services/Contacts/ContactTransformer.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { isNull } from 'lodash';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { IContact } from '@/interfaces';
|
||||
|
||||
export default class ContactTransfromer extends Transformer {
|
||||
/**
|
||||
* Retrieve formatted expense amount.
|
||||
* @param {IExpense} expense
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedBalance = (contact: IContact): string => {
|
||||
return formatNumber(contact.balance, {
|
||||
currencyCode: contact.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve formatted expense landed cost amount.
|
||||
* @param {IExpense} expense
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedOpeningBalance = (contact: IContact): string => {
|
||||
return !isNull(contact.openingBalance)
|
||||
? formatNumber(contact.openingBalance, {
|
||||
currencyCode: contact.currencyCode,
|
||||
})
|
||||
: '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Retriecve fromatted date.
|
||||
* @param {IExpense} expense
|
||||
* @returns {string}
|
||||
*/
|
||||
protected formattedOpeningBalanceAt = (contact: IContact): string => {
|
||||
return !isNull(contact.openingBalanceAt)
|
||||
? this.formatDate(contact.openingBalanceAt)
|
||||
: '';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user