feat: Expenses resource.

This commit is contained in:
Ahmed Bouhuolia
2020-06-07 22:20:52 +02:00
parent 54f10f6a9e
commit fe240c058b
14 changed files with 1226 additions and 288 deletions

View File

@@ -1,19 +1,18 @@
exports.up = function(knex) {
return knex.schema.createTable('expenses', (table) => {
return knex.schema.createTable('expenses_transactions', (table) => {
table.increments();
table.decimal('amount');
table.decimal('total_amount');
table.string('currency_code');
table.decimal('exchange_rate');
table.text('description');
table.integer('expense_account_id').unsigned();
table.integer('payment_account_id').unsigned();
table.string('reference');
table.integer('payee_id').unsigned();
table.string('reference_no');
table.boolean('published').defaultTo(false);
table.integer('user_id').unsigned();
table.date('date');
// table.timestamps();
})
table.date('payment_date');
table.timestamps();
}).raw('ALTER TABLE `EXPENSES_TRANSACTIONS` AUTO_INCREMENT = 1000');
};
exports.down = function(knex) {

View File

@@ -0,0 +1,16 @@
exports.up = function(knex) {
return knex.schema.createTable('expense_transaction_categories', table => {
table.increments();
table.integer('expense_account_id').unsigned();
table.integer('index').unsigned();
table.text('description');
table.decimal('amount');
table.integer('expense_id').unsigned();
table.timestamps();
}).raw('ALTER TABLE `EXPENSE_TRANSACTION_CATEGORIES` AUTO_INCREMENT = 1000');;
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('expense_transaction_categories');
};

View File

@@ -0,0 +1,8 @@
exports.up = function(knex) {
};
exports.down = function(knex) {
};