mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
37 lines
758 B
TypeScript
37 lines
758 B
TypeScript
import { Model, mixin } from 'objection';
|
|
import SystemModel from '@/system/models/SystemModel';
|
|
|
|
export default class PlanFeature extends mixin(SystemModel) {
|
|
/**
|
|
* Table name.
|
|
*/
|
|
static get tableName() {
|
|
return 'subscriptions.plan_features';
|
|
}
|
|
|
|
/**
|
|
* Timestamps columns.
|
|
*/
|
|
static get timestamps() {
|
|
return ['createdAt', 'updatedAt'];
|
|
}
|
|
|
|
/**
|
|
* Relationship mapping.
|
|
*/
|
|
static get relationMappings() {
|
|
const Plan = require('system/models/Subscriptions/Plan');
|
|
|
|
return {
|
|
plan: {
|
|
relation: Model.BelongsToOneRelation,
|
|
modelClass: Plan.default,
|
|
join: {
|
|
from: 'subscriptions.plan_features.planId',
|
|
to: 'subscriptions.plans.id',
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|