mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
WIP
This commit is contained in:
@@ -170,7 +170,7 @@ factory.define('resource_field', 'resource_fields', async () => {
|
||||
|
||||
return {
|
||||
label_name: faker.lorem.words(),
|
||||
slug: faker.lorem.slug(),
|
||||
key: faker.lorem.slug(),
|
||||
data_type: dataTypes[Math.floor(Math.random() * dataTypes.length)],
|
||||
help_text: faker.lorem.words(),
|
||||
default: faker.lorem.word(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
exports.up = function (knex) {
|
||||
exports.up = (knex) => {
|
||||
return knex.schema.createTable('account_types', (table) => {
|
||||
table.increments();
|
||||
table.string('name');
|
||||
|
||||
@@ -3,12 +3,13 @@ exports.up = function (knex) {
|
||||
return knex.schema.createTable('resource_fields', (table) => {
|
||||
table.increments();
|
||||
table.string('label_name');
|
||||
table.string('slug');
|
||||
table.string('key');
|
||||
table.string('data_type');
|
||||
table.string('help_text');
|
||||
table.string('default');
|
||||
table.boolean('active');
|
||||
table.boolean('predefined');
|
||||
table.boolean('builtin').defaultTo(false);
|
||||
table.boolean('columnable');
|
||||
table.integer('index');
|
||||
table.json('options');
|
||||
|
||||
@@ -5,6 +5,7 @@ exports.up = function (knex) {
|
||||
table.string('name');
|
||||
table.boolean('predefined');
|
||||
table.integer('resource_id').unsigned().references('id').inTable('resources');
|
||||
table.boolean('favourite');
|
||||
table.string('roles_logic_expression');
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
exports.up = function(knex) {
|
||||
|
||||
};
|
||||
|
||||
exports.down = function(knex) {
|
||||
|
||||
};
|
||||
64
server/src/database/seeds/account_types.js
Normal file
64
server/src/database/seeds/account_types.js
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
exports.seed = (knex) => {
|
||||
// Deletes ALL existing entries
|
||||
return knex('account_types').del()
|
||||
.then(() => {
|
||||
// Inserts seed entries
|
||||
return knex('account_types').insert([
|
||||
{
|
||||
id: 1,
|
||||
name: 'Fixed Asset',
|
||||
balance_sheet: true,
|
||||
income_sheet: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Current Asset',
|
||||
balance_sheet: true,
|
||||
income_sheet: false,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Long Term Liability',
|
||||
balance_sheet: false,
|
||||
income_sheet: true,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'Current Liability',
|
||||
balance_sheet: false,
|
||||
income_sheet: true,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'Equity',
|
||||
balance_sheet: false,
|
||||
income_sheet: true,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'Expense',
|
||||
balance_sheet: false,
|
||||
income_sheet: true,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'Income',
|
||||
balance_sheet: false,
|
||||
income_sheet: true,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'Accounts Receivable',
|
||||
balance_sheet: true,
|
||||
income_sheet: false,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'Accounts Payable',
|
||||
balance_sheet: true,
|
||||
income_sheet: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
};
|
||||
100
server/src/database/seeds/accounts.js
Normal file
100
server/src/database/seeds/accounts.js
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
exports.seed = (knex) => {
|
||||
// Deletes ALL existing entries
|
||||
return knex('accounts').del()
|
||||
.then(() => {
|
||||
// Inserts seed entries
|
||||
return knex('accounts').insert([
|
||||
{
|
||||
id: 1,
|
||||
name: 'Petty Cash',
|
||||
account_type_id: 2,
|
||||
parent_account_id: null,
|
||||
code: '10000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Bank',
|
||||
account_type_id: 2,
|
||||
parent_account_id: null,
|
||||
code: '20000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'Other Income',
|
||||
account_type_id: 7,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'Interest Income',
|
||||
account_type_id: 7,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'Opening Balance',
|
||||
account_type_id: 5,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: 'Depreciation Expense',
|
||||
account_type_id: 6,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'Interest Expense',
|
||||
account_type_id: 6,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'Payroll Expenses',
|
||||
account_type_id: 6,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'Other Expenses',
|
||||
account_type_id: 6,
|
||||
parent_account_id: null,
|
||||
code: '1000',
|
||||
description: '',
|
||||
active: 1,
|
||||
index: 1,
|
||||
}
|
||||
]);
|
||||
});
|
||||
};
|
||||
14
server/src/database/seeds/seed_accounts_fields.js
Normal file
14
server/src/database/seeds/seed_accounts_fields.js
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
exports.seed = function(knex) {
|
||||
// Deletes ALL existing entries
|
||||
return knex('resource_fields').del()
|
||||
.then(() => {
|
||||
// Inserts seed entries
|
||||
return knex('resource_fields').insert([
|
||||
{id: 1, label_name: 'Name', key: 'name', data_type: '', active: 1, predefined: 1},
|
||||
{id: 2, label_name: 'Code', key: 'code', data_type: '', active: 1, predefined: 1},
|
||||
{id: 3, label_name: 'Account Type', key: 'account_type_id', data_type: '', active: 1, predefined: 1},
|
||||
{id: 4, label_name: 'Description', key: 'description', data_type: '', active: 1, predefined: 1},
|
||||
]);
|
||||
});
|
||||
};
|
||||
13
server/src/database/seeds/seed_resources.js
Normal file
13
server/src/database/seeds/seed_resources.js
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
exports.seed = (knex) => {
|
||||
// Deletes ALL existing entries
|
||||
return knex('resources').del()
|
||||
.then(() => {
|
||||
// Inserts seed entries
|
||||
return knex('resources').insert([
|
||||
{ id: 1, name: 'accounts' },
|
||||
{ id: 2, name: 'items' },
|
||||
{ id: 3, name: 'expenses' },
|
||||
]);
|
||||
});
|
||||
};
|
||||
83
server/src/database/seeds/seed_resources_fields.js
Normal file
83
server/src/database/seeds/seed_resources_fields.js
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
exports.seed = (knex) => {
|
||||
return knex('resource_fields').del()
|
||||
.then(() => {
|
||||
return knex('resource_fields').insert([
|
||||
// Accounts
|
||||
{
|
||||
id: 1,
|
||||
resource_id: 1,
|
||||
label_name: 'Account Name',
|
||||
data_type: 'textbox',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
resource_id: 1,
|
||||
label_name: 'Code',
|
||||
data_type: 'textbox',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
resource_id: 1,
|
||||
label_name: 'Type',
|
||||
data_type: 'options',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
resource_id: 1,
|
||||
label_name: 'Type',
|
||||
data_type: 'normal',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
resource_id: 1,
|
||||
label_name: 'Description',
|
||||
data_type: 'textarea',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
|
||||
// Expenses
|
||||
{
|
||||
id: 6,
|
||||
resource_id: 3,
|
||||
label_name: 'Date',
|
||||
data_type: 'date',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
resource_id: 3,
|
||||
label_name: 'Expense Account',
|
||||
data_type: 'options',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
resource_id: 3,
|
||||
label_name: 'Payment Account',
|
||||
data_type: 'options',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
resource_id: 3,
|
||||
label_name: 'Amount',
|
||||
data_type: 'number',
|
||||
predefined: 1,
|
||||
columnable: true,
|
||||
},
|
||||
]);
|
||||
});
|
||||
};
|
||||
18
server/src/database/seeds/users.js
Normal file
18
server/src/database/seeds/users.js
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
exports.seed = (knex) => {
|
||||
return knex('users').del()
|
||||
.then(() => {
|
||||
return knex('users').insert([
|
||||
{
|
||||
first_name: 'Ahmed',
|
||||
last_name: 'Mohamed',
|
||||
email: 'admin@admin.com',
|
||||
phone_number: '0920000000',
|
||||
password: '$2b$10$LGSMrezP8IHBb/cNMlc1ZOKA59Fc9rY0IEk2u.iuF/y6yS2YlGP7i', // test
|
||||
active: 1,
|
||||
language: 'ar',
|
||||
created_at: new Date(),
|
||||
},
|
||||
]);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user