mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
WIP Items module.
This commit is contained in:
23
server/src/models/ItemCategory.js
Normal file
23
server/src/models/ItemCategory.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import bookshelf from './bookshelf';
|
||||
|
||||
const ItemCategory = bookshelf.Model.extend({
|
||||
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
tableName: 'items_categories',
|
||||
|
||||
/**
|
||||
* Timestamp columns.
|
||||
*/
|
||||
hasTimestamps: ['created_at', 'updated_at'],
|
||||
|
||||
/**
|
||||
* Item category may has many items.
|
||||
*/
|
||||
items() {
|
||||
return this.hasMany('Item', 'category_id');
|
||||
},
|
||||
});
|
||||
|
||||
export default bookshelf.model('ItemCategory', ItemCategory);
|
||||
Reference in New Issue
Block a user