feat: items list restful api.

This commit is contained in:
Ahmed Bouhuolia
2020-03-24 16:47:35 +02:00
parent 2ab714127a
commit 1894ad3b18
10 changed files with 371 additions and 43 deletions

View File

@@ -91,14 +91,17 @@ factory.define('item_metadata', 'items_metadata', async () => {
factory.define('item', 'items', async () => {
const category = await factory.create('item_category');
const account = await factory.create('account');
const costAccount = await factory.create('account');
const sellAccount = await factory.create('account');
const inventoryAccount = await factory.create('account');
return {
name: faker.lorem.word(),
note: faker.lorem.paragraph(),
cost_price: faker.random.number(),
sell_price: faker.random.number(),
cost_account_id: account.id,
sell_account_id: account.id,
cost_account_id: costAccount.id,
sell_account_id: sellAccount.id,
inventory_account_id: inventoryAccount.id,
category_id: category.id,
};
});

View File

@@ -10,6 +10,7 @@ exports.up = function (knex) {
table.string('picture_uri');
table.integer('cost_account_id').unsigned();
table.integer('sell_account_id').unsigned();
table.integer('inventory_account_id').unsigned();
table.text('note').nullable();
table.integer('category_id').unsigned();
table.integer('user_id').unsigned();