feat: licenses administration basic authentication.

feat: accounts slug.
feat: duplicate accounts_balance table and merge balance with accounts table.
feat: refactoring customers and vendors.
feat: system user soft deleting.
feat: preventing build tenant database without any subscription.
feat: remove 'password' property from 'req.user' object.
feat: refactoring JournalPoster class.
feat: delete duplicated directories and files.
This commit is contained in:
Ahmed Bouhuolia
2020-09-09 21:30:19 +02:00
parent 98bba3d3a0
commit ad00f140d1
77 changed files with 2431 additions and 1848 deletions

View File

@@ -0,0 +1,170 @@
// Contact Interfaces.
// ----------------------------------
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{
contactService: 'customer' | 'vendor',
contactType: string,
balance: number,
openingBalance: number,
firstName: string,
lastName: string,
companyName: string,
displayName: string,
email: string,
workPhone: string,
personalPhone: string,
note: string,
active: boolean,
}
export interface IContactNewDTO {
contactType?: string,
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active: boolean,
}
export interface IContactEditDTO {
contactType?: string,
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active: boolean,
}
// Customer Interfaces.
// ----------------------------------
export interface ICustomer extends IContact {
contactService: 'customer',
}
export interface ICustomerNewDTO extends IContactAddressDTO {
customerType: string,
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active?: boolean,
};
export interface ICustomerEditDTO extends IContactAddressDTO {
customerType: string,
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active?: boolean,
};
// Vendor Interfaces.
// ----------------------------------
export interface IVendor extends IContact {
contactService: 'vendor',
}
export interface IVendorNewDTO extends IContactAddressDTO {
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active?: boolean,
};
export interface IVendorEditDTO extends IContactAddressDTO {
openingBalance?: number,
firstName?: string,
lastName?: string,
companyName?: string,
displayName?: string,
email?: string,
workPhone?: string,
personalPhone?: string,
note?: string,
active?: boolean,
};

View File

@@ -0,0 +1,40 @@
export interface IJournalEntry {
index?: number,
date: Date,
credit: number,
debit: number,
account: number,
referenceType: string,
referenceId: number,
transactionType?: string,
note?: string,
userId?: number,
contactType?: string,
contactId?: number,
};
export interface IJournalPoster {
credit(entry: IJournalEntry): void;
debit(entry: IJournalEntry): void;
removeEntries(ids: number[]): void;
saveEntries(): void;
saveBalance(): void;
deleteEntries(): void;
}
export type TEntryType = 'credit' | 'debit';
export interface IAccountChange {
credit: number,
debit: number,
};
export interface IAccountsChange {
[key: string]: IAccountChange,
};

View File

@@ -50,6 +50,22 @@ import {
IAccount,
IAccountDTO,
} from './Account';
import {
IJournalEntry,
IJournalPoster,
TEntryType,
IAccountChange,
IAccountsChange,
} from './Journal';
import {
IContactAddress,
IContact,
IContactNewDTO,
IContactEditDTO,
ICustomer,
ICustomerNewDTO,
ICustomerEditDTO,
} from './Contact';
export {
IAccount,
@@ -96,4 +112,18 @@ export {
IOptionDTO,
IOptionsDTO,
IJournalEntry,
IJournalPoster,
TEntryType,
IAccountChange,
IAccountsChange,
IContactAddress,
IContact,
IContactNewDTO,
IContactEditDTO,
ICustomer,
ICustomerNewDTO,
ICustomerEditDTO,
};