mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix issues.
This commit is contained in:
@@ -12,6 +12,9 @@ export default class Item extends TenantModel {
|
||||
return 'items';
|
||||
}
|
||||
|
||||
/**
|
||||
* Model modifiers.
|
||||
*/
|
||||
static get modifiers() {
|
||||
const TABLE_NAME = Item.tableName;
|
||||
|
||||
@@ -29,6 +32,7 @@ export default class Item extends TenantModel {
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Media = require('@/models/Media');
|
||||
const Account = require('@/models/Account');
|
||||
const ItemCategory = require('@/models/ItemCategory');
|
||||
|
||||
@@ -71,6 +75,19 @@ export default class Item extends TenantModel {
|
||||
to: 'accounts.id',
|
||||
},
|
||||
},
|
||||
|
||||
media: {
|
||||
relation: Model.ManyToManyRelation,
|
||||
modelClass: this.relationBindKnex(Media.default),
|
||||
join: {
|
||||
from: 'items.id',
|
||||
through: {
|
||||
from: 'media_links.model_id',
|
||||
to: 'media_links.media_id',
|
||||
},
|
||||
to: 'media.id',
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user