WIP Items module.

This commit is contained in:
Ahmed Bouhuolia
2019-09-03 02:07:28 +02:00
parent cb8c294d74
commit 70809cb05c
142 changed files with 12674 additions and 64 deletions

30
server/src/models/Item.js Normal file
View File

@@ -0,0 +1,30 @@
import bookshelf from './bookshelf';
const Item = bookshelf.Model.extend({
/**
* Table name
*/
tableName: 'items',
/**
* Timestamp columns.
*/
hasTimestamps: false,
/**
* Item may has many meta data.
*/
metadata() {
return this.hasMany('ItemMetadata', 'item_id');
},
/**
* Item may belongs to the item category.
*/
category() {
return this.belongsTo('ItemCategory', 'category_id');
},
});
export default bookshelf.model('Item', Item);