mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
WIP Items module.
This commit is contained in:
30
server/src/models/Item.js
Normal file
30
server/src/models/Item.js
Normal 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);
|
||||
Reference in New Issue
Block a user