refactor: wip to nestjs

This commit is contained in:
Ahmed Bouhuolia
2024-12-25 00:43:55 +02:00
parent 336171081e
commit a6932d76f3
249 changed files with 21314 additions and 1616 deletions

View File

@@ -0,0 +1,38 @@
import { ContactTransfromer } from "../../Contacts/Contact.transformer";
export class CustomerTransfromer extends ContactTransfromer {
/**
* Include these attributes to expense object.
* @returns {Array}
*/
public includeAttributes = (): string[] => {
return [
'formattedBalance',
'formattedOpeningBalance',
'formattedOpeningBalanceAt',
'customerType',
'formattedCustomerType',
];
};
/**
* Retrieve customer type.
* @returns {string}
*/
protected customerType = (customer): string => {
return customer.contactType;
};
/**
* Retrieve the formatted customer type.
* @param customer
* @returns {string}
*/
protected formattedCustomerType = (customer): string => {
const keywords = {
individual: 'customer.type.individual',
business: 'customer.type.business',
};
return this.context.i18n.t(keywords[customer.contactType] || '');
};
}