Files
bigcapital/server/src/models/ViewRole.js
2020-09-16 21:41:09 +02:00

47 lines
865 B
JavaScript

import { Model } from 'objection';
import TenantModel from 'models/TenantModel';
export default class ViewRole extends TenantModel {
/**
* Virtual attributes.
*/
static get virtualAttributes() {
return ['comparators'];
}
static get comparators() {
return [
'equals', 'not_equal', 'contains', 'not_contain',
];
}
/**
* Table name.
*/
static get tableName() {
return 'view_roles';
}
/**
* Relationship mapping.
*/
static get relationMappings() {
const View = require('models/View');
return {
/**
* View role model may belongs to view model.
*/
view: {
relation: Model.BelongsToOneRelation,
modelClass: this.relationBindKnex(View.default),
join: {
from: 'view_roles.viewId',
to: 'views.id',
},
},
};
}
}