feat: Re-compute the given items cost job.

feat: Optimize the architecture.
This commit is contained in:
Ahmed Bouhuolia
2020-08-18 02:28:08 +02:00
parent 4e68a7db71
commit d423365a19
44 changed files with 1605 additions and 798 deletions

View File

@@ -4,9 +4,9 @@ import knexfile from '@/../config/systemKnexfile';
const config = knexfile[process.env.NODE_ENV];
const knex = Knex({
...config,
...knexSnakeCaseMappers({ upperCase: true }),
});
export default knex;
export default () => {
return Knex({
...config,
...knexSnakeCaseMappers({ upperCase: true }),
});
};

View File

@@ -6,9 +6,9 @@ exports.up = function(knex) {
table.string('direction');
table.integer('item_id');
table.integer('quantity');
table.decimal('rate', 13, 3);
table.integer('item_id').unsigned();
table.integer('quantity').unsigned();
table.decimal('rate', 13, 3).unsigned();
table.string('transaction_type');
table.integer('transaction_id');

View File

@@ -6,9 +6,11 @@ exports.up = function(knex) {
table.string('direction');
table.integer('item_id');
table.integer('item_id').unsigned();
table.integer('quantity').unsigned();
table.decimal('rate', 13, 3);
table.integer('remaining');
table.string('lot_number');
table.string('transaction_type');
table.integer('transaction_id');

View File

@@ -1,7 +1,8 @@
import { Model } from 'objection';
import knex from '@/database/knex';
// Bind all Models to a knex instance. If you only have one database in
// your server this is all you have to do. For multi database systems, see
// the Model.bindKnex() method.
Model.knex(knex);
export default ({ knex }) => {
Model.knex(knex);
};

View File

@@ -7,7 +7,6 @@ exports.seed = (knex) => {
return knex('resources').insert([
{ id: 1, name: 'accounts' },
{ id: 8, name: 'accounts_types' },
{ id: 2, name: 'items' },
{ id: 3, name: 'expenses' },
{ id: 4, name: 'manual_journals' },