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

@@ -3,6 +3,7 @@ exports.up = function (knex) {
return knex.schema.createTable('accounts', (table) => {
table.bigIncrements('id').comment('Auto-generated id');;
table.string('name');
table.string('slug');
table.integer('account_type_id').unsigned();
table.integer('parent_account_id').unsigned();
table.string('code', 10);
@@ -10,6 +11,8 @@ exports.up = function (knex) {
table.boolean('active').defaultTo(true);
table.integer('index').unsigned();
table.boolean('predefined').defaultTo(false);
table.decimal('amount', 15, 5);
table.string('currency_code', 3);
table.timestamps();
}).raw('ALTER TABLE `ACCOUNTS` AUTO_INCREMENT = 1000').then(() => {
return knex.seed.run({

View File

@@ -1,11 +0,0 @@
exports.up = function (knex) {
return knex.schema.createTable('account_balances', (table) => {
table.increments();
table.integer('account_id');
table.decimal('amount', 15, 5);
table.string('currency_code', 3);
});
};
exports.down = (knex) => knex.schema.dropTableIfExists('account_balances');

View File

@@ -13,6 +13,7 @@ exports.up = function(knex) {
table.string('note');
table.boolean('draft').defaultTo(false);
table.integer('user_id').unsigned();
table.integer('index').unsigned();
table.date('date');
table.timestamps();
}).raw('ALTER TABLE `ACCOUNTS_TRANSACTIONS` AUTO_INCREMENT = 1000');

View File

@@ -0,0 +1,49 @@
exports.up = function(knex) {
return knex.schema.createTable('contacts', table => {
table.increments();
table.string('contact_service');
table.string('contact_type');
table.decimal('balance', 13, 3).defaultTo(0);
table.decimal('opening_balance', 13, 3).defaultTo(0);
table.string('first_name').nullable();
table.string('last_name').nullable();
table.string('company_name').nullable();
table.string('display_name');
table.string('email').nullable();
table.string('work_phone').nullable();
table.string('personal_phone').nullable();
table.string('billing_address_1').nullable();
table.string('billing_address_2').nullable();
table.string('billing_address_city').nullable();
table.string('billing_address_country').nullable();
table.string('billing_address_email').nullable();
table.string('billing_address_zipcode').nullable();
table.string('billing_address_phone').nullable();
table.string('billing_address_state').nullable(),
table.string('shipping_address_1').nullable();
table.string('shipping_address_2').nullable();
table.string('shipping_address_city').nullable();
table.string('shipping_address_country').nullable();
table.string('shipping_address_email').nullable();
table.string('shipping_address_zipcode').nullable();
table.string('shipping_address_phone').nullable();
table.string('shipping_address_state').nullable();
table.text('note');
table.boolean('active').defaultTo(true);
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('contacts');
};

View File

@@ -8,6 +8,7 @@ exports.seed = (knex) => {
{
id: 1,
name: 'Petty Cash',
slug: 'petty-cash',
account_type_id: 2,
parent_account_id: null,
code: '1000',
@@ -19,6 +20,7 @@ exports.seed = (knex) => {
{
id: 2,
name: 'Bank',
slug: 'bank',
account_type_id: 2,
parent_account_id: null,
code: '2000',
@@ -30,6 +32,7 @@ exports.seed = (knex) => {
{
id: 3,
name: 'Other Income',
slug: 'other-income',
account_type_id: 7,
parent_account_id: null,
code: '1000',
@@ -41,6 +44,7 @@ exports.seed = (knex) => {
{
id: 4,
name: 'Interest Income',
slug: 'interest-income',
account_type_id: 7,
parent_account_id: null,
code: '1000',
@@ -52,6 +56,7 @@ exports.seed = (knex) => {
{
id: 5,
name: 'Opening Balance',
slug: 'opening-balance',
account_type_id: 5,
parent_account_id: null,
code: '1000',
@@ -63,6 +68,7 @@ exports.seed = (knex) => {
{
id: 6,
name: 'Depreciation Expense',
slug: 'depreciation-expense',
account_type_id: 6,
parent_account_id: null,
code: '1000',
@@ -74,6 +80,7 @@ exports.seed = (knex) => {
{
id: 7,
name: 'Interest Expense',
slug: 'interest-expense',
account_type_id: 6,
parent_account_id: null,
code: '1000',
@@ -85,6 +92,7 @@ exports.seed = (knex) => {
{
id: 8,
name: 'Payroll Expenses',
slug: 'payroll-expenses',
account_type_id: 6,
parent_account_id: null,
code: '1000',
@@ -96,6 +104,7 @@ exports.seed = (knex) => {
{
id: 9,
name: 'Other Expenses',
slug: 'other-expenses',
account_type_id: 6,
parent_account_id: null,
code: '1000',
@@ -107,6 +116,7 @@ exports.seed = (knex) => {
{
id: 10,
name: 'Accounts Receivable',
slug: 'accounts-receivable',
account_type_id: 8,
parent_account_id: null,
code: '1000',
@@ -118,6 +128,7 @@ exports.seed = (knex) => {
{
id: 11,
name: 'Accounts Payable',
slug: 'accounts-payable',
account_type_id: 9,
parent_account_id: null,
code: '1000',
@@ -129,6 +140,7 @@ exports.seed = (knex) => {
{
id: 12,
name: 'Cost of Goods Sold (COGS)',
slug: 'cost-of-goods-sold',
account_type_id: 12,
predefined: 1,
parent_account_id: null,
@@ -139,6 +151,7 @@ exports.seed = (knex) => {
{
id: 13,
name: 'Inventory Asset',
slug: 'inventory-asset',
account_type_id: 14,
predefined: 1,
parent_account_id: null,
@@ -149,6 +162,7 @@ exports.seed = (knex) => {
{
id: 14,
name: 'Sales of Product Income',
slug: 'sales-of-product-income',
account_type_id: 7,
predefined: 1,
parent_account_id: null,