add server to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 11:57:50 +02:00
parent 28e309981b
commit 80b97b5fdc
1303 changed files with 137049 additions and 0 deletions

View File

@@ -0,0 +1,229 @@
export const ACCOUNT_TYPE = {
CASH: 'cash',
BANK: 'bank',
ACCOUNTS_RECEIVABLE: 'accounts-receivable',
INVENTORY: 'inventory',
OTHER_CURRENT_ASSET: 'other-current-asset',
FIXED_ASSET: 'fixed-asset',
NON_CURRENT_ASSET: 'none-current-asset',
ACCOUNTS_PAYABLE: 'accounts-payable',
CREDIT_CARD: 'credit-card',
TAX_PAYABLE: 'tax-payable',
OTHER_CURRENT_LIABILITY: 'other-current-liability',
LOGN_TERM_LIABILITY: 'long-term-liability',
NON_CURRENT_LIABILITY: 'non-current-liability',
EQUITY: 'equity',
INCOME: 'income',
OTHER_INCOME: 'other-income',
COST_OF_GOODS_SOLD: 'cost-of-goods-sold',
EXPENSE: 'expense',
OTHER_EXPENSE: 'other-expense',
};
export const ACCOUNT_PARENT_TYPE = {
CURRENT_ASSET: 'current-asset',
FIXED_ASSET: 'fixed-asset',
NON_CURRENT_ASSET: 'non-current-asset',
CURRENT_LIABILITY: 'current-liability',
LOGN_TERM_LIABILITY: 'long-term-liability',
NON_CURRENT_LIABILITY: 'non-current-liability',
EQUITY: 'equity',
EXPENSE: 'expense',
INCOME: 'income',
};
export const ACCOUNT_ROOT_TYPE = {
ASSET: 'asset',
LIABILITY: 'liability',
EQUITY: 'equity',
EXPENSE: 'expense',
INCOME: 'income',
};
export const ACCOUNT_NORMAL = {
CREDIT: 'credit',
DEBIT: 'debit',
};
export const ACCOUNT_TYPES = [
{
label: 'Cash',
key: ACCOUNT_TYPE.CASH,
normal: ACCOUNT_NORMAL.DEBIT,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_ASSET,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
multiCurrency: true,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Bank',
key: ACCOUNT_TYPE.BANK,
normal: ACCOUNT_NORMAL.DEBIT,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_ASSET,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
multiCurrency: true,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Accounts Receivable',
key: ACCOUNT_TYPE.ACCOUNTS_RECEIVABLE,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_ASSET,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Inventory',
key: ACCOUNT_TYPE.INVENTORY,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_ASSET,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Other Current Asset',
key: ACCOUNT_TYPE.OTHER_CURRENT_ASSET,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_ASSET,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Fixed Asset',
key: ACCOUNT_TYPE.FIXED_ASSET,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
parentType: ACCOUNT_PARENT_TYPE.FIXED_ASSET,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Non-Current Asset',
key: ACCOUNT_TYPE.NON_CURRENT_ASSET,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.ASSET,
parentType: ACCOUNT_PARENT_TYPE.FIXED_ASSET,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Accounts Payable',
key: ACCOUNT_TYPE.ACCOUNTS_PAYABLE,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_LIABILITY,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Credit Card',
key: ACCOUNT_TYPE.CREDIT_CARD,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_LIABILITY,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Tax Payable',
key: ACCOUNT_TYPE.TAX_PAYABLE,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_LIABILITY,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Other Current Liability',
key: ACCOUNT_TYPE.OTHER_CURRENT_LIABILITY,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.CURRENT_LIABILITY,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Long Term Liability',
key: ACCOUNT_TYPE.LOGN_TERM_LIABILITY,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.LOGN_TERM_LIABILITY,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Non-Current Liability',
key: ACCOUNT_TYPE.NON_CURRENT_LIABILITY,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.LIABILITY,
parentType: ACCOUNT_PARENT_TYPE.NON_CURRENT_LIABILITY,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Equity',
key: ACCOUNT_TYPE.EQUITY,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.EQUITY,
parentType: ACCOUNT_PARENT_TYPE.EQUITY,
balanceSheet: true,
incomeSheet: false,
},
{
label: 'Income',
key: ACCOUNT_TYPE.INCOME,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.INCOME,
parentType: ACCOUNT_PARENT_TYPE.INCOME,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Other Income',
key: ACCOUNT_TYPE.OTHER_INCOME,
normal: ACCOUNT_NORMAL.CREDIT,
rootType: ACCOUNT_ROOT_TYPE.INCOME,
parentType: ACCOUNT_PARENT_TYPE.INCOME,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Cost of Goods Sold',
key: ACCOUNT_TYPE.COST_OF_GOODS_SOLD,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.EXPENSE,
parentType: ACCOUNT_PARENT_TYPE.EXPENSE,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Expense',
key: ACCOUNT_TYPE.EXPENSE,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.EXPENSE,
parentType: ACCOUNT_PARENT_TYPE.EXPENSE,
balanceSheet: false,
incomeSheet: true,
},
{
label: 'Other Expense',
key: ACCOUNT_TYPE.OTHER_EXPENSE,
normal: ACCOUNT_NORMAL.DEBIT,
rootType: ACCOUNT_ROOT_TYPE.EXPENSE,
parentType: ACCOUNT_PARENT_TYPE.EXPENSE,
balanceSheet: false,
incomeSheet: true,
},
];
export const getAccountsSupportsMultiCurrency = () => {
return ACCOUNT_TYPES.filter((account) => account.multiCurrency);
};

View File

@@ -0,0 +1,96 @@
import { IBalanceSheetStructureSection } from '@/interfaces';
import {
ACCOUNT_TYPE
} from '@/data/AccountTypes';
const balanceSheetStructure: IBalanceSheetStructureSection[] = [
{
name: 'Assets',
sectionType: 'assets',
type: 'section',
children: [
{
name: 'Current Asset',
sectionType: 'assets',
type: 'section',
children: [
{
name: 'Cash and cash equivalents',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.CASH, ACCOUNT_TYPE.BANK],
},
{
name: 'Accounts Receivable',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.ACCOUNTS_RECEIVABLE],
},
{
name: 'Inventories',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.INVENTORY],
},
{
name: 'Other current assets',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.OTHER_CURRENT_ASSET],
},
],
alwaysShow: true,
},
{
name: 'Fixed Asset',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.FIXED_ASSET],
},
{
name: 'Non-Current Assets',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.NON_CURRENT_ASSET],
}
],
alwaysShow: true,
},
{
name: 'Liabilities and Equity',
sectionType: 'liabilities_equity',
type: 'section',
children: [
{
name: 'Liabilities',
sectionType: 'liability',
type: 'section',
children: [
{
name: 'Current Liabilties',
type: 'accounts_section',
accountsTypes: [
ACCOUNT_TYPE.ACCOUNTS_PAYABLE,
ACCOUNT_TYPE.TAX_PAYABLE,
ACCOUNT_TYPE.CREDIT_CARD,
ACCOUNT_TYPE.OTHER_CURRENT_LIABILITY,
],
},
{
name: 'Long-Term Liabilities',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.LOGN_TERM_LIABILITY],
},
{
name: 'Non-Current Liabilities',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.NON_CURRENT_LIABILITY],
}
],
},
{
name: 'Equity',
sectionType: 'equity',
type: 'accounts_section',
accountsTypes: [ACCOUNT_TYPE.EQUITY],
},
],
alwaysShow: true,
},
];
export default balanceSheetStructure;

View File

@@ -0,0 +1,8 @@
export const DATATYPES_LENGTH = {
STRING: 255,
TEXT: 65535,
INT_10: 4294967295,
DECIMAL_13_3: 9999999999.999,
DECIMAL_15_5: 999999999999.999,
};

View File

@@ -0,0 +1,205 @@
/* eslint-disable quote-props */
export default {
// Expenses.
expense: {
payment_date: {
column: 'payment_date',
},
payment_account: {
column: 'payment_account_id',
relation: 'accounts.id',
},
amount: {
column: 'total_amount',
},
currency_code: {
column: 'currency_code',
},
reference_no: {
column: 'reference_no'
},
description: {
column: 'description',
},
published: {
column: 'published',
},
user: {
column: 'user_id',
relation: 'users.id',
relationColumn: 'users.id',
},
},
// Accounts
Account: {
name: {
column: 'name',
},
type: {
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.key',
},
description: {
column: 'description',
},
code: {
column: 'code',
},
root_type: {
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.root_type',
},
created_at: {
column: 'created_at',
columnType: 'date',
},
active: {
column: 'active',
},
balance: {
column: 'amount',
columnType: 'number'
},
currency: {
column: 'currency_code',
},
normal: {
column: 'account_type_id',
relation: 'account_types.id',
relationColumn: 'account_types.normal'
},
},
// Items
item: {
type: {
column: 'type',
},
name: {
column: 'name',
},
sellable: {
column: 'sellable',
},
purchasable: {
column: 'purchasable',
},
sell_price: {
column: 'sell_price'
},
cost_price: {
column: 'cost_price',
},
currency_code: {
column: 'currency_code',
},
cost_account: {
column: 'cost_account_id',
relation: 'accounts.id',
},
sell_account: {
column: 'sell_account_id',
relation: 'accounts.id',
},
inventory_account: {
column: 'inventory_account_id',
relation: 'accounts.id',
},
sell_description: {
column: 'sell_description',
},
purchase_description: {
column: 'purchase_description',
},
quantity_on_hand: {
column: 'quantity_on_hand',
},
note: {
column: 'note',
},
category: {
column: 'category_id',
relation: 'categories.id',
},
user: {
column: 'user_id',
relation: 'users.id',
relationColumn: 'users.id',
},
created_at: {
column: 'created_at',
}
},
// Item category.
item_category: {
name: {
column: 'name',
},
description: {
column: 'description',
},
parent_category_id: {
column: 'parent_category_id',
relation: 'items_categories.id',
relationColumn: 'items_categories.id',
},
user: {
column: 'user_id',
relation: 'users.id',
relationColumn: 'users.id',
},
cost_account: {
column: 'cost_account_id',
relation: 'accounts.id',
},
sell_account: {
column: 'sell_account_id',
relation: 'accounts.id',
},
inventory_account: {
column: 'inventory_account_id',
relation: 'accounts.id',
},
cost_method: {
column: 'cost_method',
},
},
// Manual Journals
manual_journal: {
date: {
column: 'date',
},
journal_number: {
column: 'journal_number',
},
reference: {
column: 'reference',
},
status: {
column: 'status',
},
amount: {
column: 'amount',
},
description: {
column: 'description',
},
user: {
column: 'user_id',
relation: 'users.id',
relationColumn: 'users.id',
},
journal_type: {
column: 'journal_type',
},
created_at: {
column: 'created_at',
},
}
};

View File

@@ -0,0 +1,212 @@
import { getTransactionsLockingSettingsSchema } from '@/api/controllers/TransactionsLocking/utils';
export default {
organization: {
name: {
type: 'string',
},
base_currency: {
type: 'string',
},
industry: {
type: 'string',
},
location: {
type: 'string',
},
fiscal_year: {
type: 'string',
},
financial_date_start: {
type: 'string',
},
language: {
type: 'string',
},
time_zone: {
type: 'string',
},
date_format: {
type: 'string',
},
accounting_basis: {
type: 'string',
},
},
manual_journals: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
bill_payments: {
withdrawal_account: {
type: 'number',
},
},
sales_estimates: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
sales_receipts: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
preferred_deposit_account: {
type: 'number',
},
},
sales_invoices: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
payment_receives: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
preferred_deposit_account: {
type: 'number',
},
preferred_advance_deposit: {
type: 'number',
},
},
items: {
preferred_sell_account: {
type: 'number',
},
preferred_cost_account: {
type: 'number',
},
preferred_inventory_account: {
type: 'number',
},
},
expenses: {
preferred_payment_account: {
type: 'number',
},
},
accounts: {
account_code_required: {
type: 'boolean',
},
account_code_unique: {
type: 'boolean',
},
},
cashflow: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
credit_note: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
vendor_credit: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
warehouse_transfers: {
next_number: {
type: 'string',
},
number_prefix: {
type: 'string',
},
auto_increment: {
type: 'boolean',
},
},
'sms-notification': {
'sms-notification-enable.sale-invoice-details': {
type: 'boolean',
},
'sms-notification-enable.sale-invoice-reminder': {
type: 'boolean',
},
'sms-notification-enable.sale-estimate-details': {
type: 'boolean',
},
'sms-notification-enable.sale-receipt-details': {
type: 'boolean',
},
'sms-notification-enable.payment-receive-details': {
type: 'boolean',
},
'sms-notification-enable.customer-balance': {
type: 'boolean',
},
},
'transactions-locking': {
'locking-type': {
type: 'string',
},
...getTransactionsLockingSettingsSchema([
'all',
'sales',
'purchases',
'financial',
]),
},
features: {
'multi-warehouses': {
type: 'boolean',
},
'multi-branches': {
type: 'boolean',
},
},
};