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,40 @@
import { isNull } from 'lodash';
import { Transformer } from '../Transformer/Transformer';
import { Contact } from './models/Contact';
export class ContactTransfromer extends Transformer {
/**
* Retrieve formatted expense amount.
* @param {IExpense} expense
* @returns {string}
*/
protected formattedBalance = (contact: Contact): string => {
return this.formatNumber(contact.balance, {
currencyCode: contact.currencyCode,
});
};
/**
* Retrieve formatted expense landed cost amount.
* @param {IExpense} expense
* @returns {string}
*/
protected formattedOpeningBalance = (contact: Contact): string => {
return !isNull(contact.openingBalance)
? this.formatNumber(contact.openingBalance, {
currencyCode: contact.currencyCode,
})
: '';
};
/**
* Retriecve fromatted date.
* @param {IExpense} expense
* @returns {string}
*/
protected formattedOpeningBalanceAt = (contact: Contact): string => {
return !isNull(contact.openingBalanceAt)
? this.formatDate(contact.openingBalanceAt)
: '';
};
}

View File

@@ -0,0 +1,124 @@
export enum ContactService {
Customer = 'customer',
Vendor = 'vendor',
}
// ----------------------------------
export interface IContactAddress {
billingAddress1: string;
billingAddress2: string;
billingAddressCity: string;
billingAddressCountry: string;
billingAddressEmail: string;
billingAddressZipcode: string;
billingAddressPhone: string;
billingAddressState: string;
shippingAddress1: string;
shippingAddress2: string;
shippingAddressCity: string;
shippingAddressCountry: string;
shippingAddressEmail: string;
shippingAddressZipcode: string;
shippingAddressPhone: string;
shippingAddressState: string;
}
export interface IContactAddressDTO {
billingAddress1?: string;
billingAddress2?: string;
billingAddressCity?: string;
billingAddressCountry?: string;
billingAddressEmail?: string;
billingAddressZipcode?: string;
billingAddressPhone?: string;
billingAddressState?: string;
shippingAddress1?: string;
shippingAddress2?: string;
shippingAddressCity?: string;
shippingAddressCountry?: string;
shippingAddressEmail?: string;
shippingAddressZipcode?: string;
shippingAddressPhone?: string;
shippingAddressState?: string;
}
export interface IContact extends IContactAddress {
id?: number;
contactService: 'customer' | 'vendor';
contactType: string;
balance: number;
currencyCode: string;
openingBalance: number;
openingBalanceExchangeRate: number;
localOpeningBalance?: number;
openingBalanceAt: Date;
openingBalanceBranchId: number;
salutation: string;
firstName: string;
lastName: string;
companyName: string;
displayName: string;
email: string;
website: string;
workPhone: string;
personalPhone: string;
note: string;
active: boolean;
}
export interface IContactNewDTO {
contactType?: string;
currencyCode?: string;
openingBalance?: number;
openingBalanceAt?: string;
salutation?: string;
firstName?: string;
lastName?: string;
companyName?: string;
displayName: string;
website?: string;
email?: string;
workPhone?: string;
personalPhone?: string;
note?: string;
active: boolean;
}
export interface IContactEditDTO {
contactType?: string;
salutation?: string;
firstName?: string;
lastName?: string;
companyName?: string;
displayName: string;
website?: string;
email?: string;
workPhone?: string;
personalPhone?: string;
note?: string;
active: boolean;
}
// export interface IContactsAutoCompleteFilter {
// limit: number;
// keyword: string;
// filterRoles?: IFilterRole[];
// columnSortBy: string;
// sortOrder: string;
// }
export interface IContactAutoCompleteItem {
displayName: string;
contactService: string;
}