mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
refactor: wip to nestjs
This commit is contained in:
@@ -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)
|
||||
: '';
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user