mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
50 lines
889 B
TypeScript
50 lines
889 B
TypeScript
import { BaseModel } from '@/models/Model';
|
|
import { Model } from 'objection';
|
|
|
|
export class SystemPlaidItem extends BaseModel {
|
|
tenantId: number;
|
|
plaidItemId: string;
|
|
|
|
/**
|
|
* Table name.
|
|
*/
|
|
static get tableName() {
|
|
return 'plaid_items';
|
|
}
|
|
|
|
/**
|
|
* Timestamps columns.
|
|
*/
|
|
get timestamps() {
|
|
return ['createdAt', 'updatedAt'];
|
|
}
|
|
|
|
/**
|
|
* Virtual attributes.
|
|
*/
|
|
static get virtualAttributes() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Relationship mapping.
|
|
*/
|
|
static get relationMappings() {
|
|
const { TenantModel } = require('../../System/models/TenantModel');
|
|
|
|
return {
|
|
/**
|
|
* System user may belongs to tenant model.
|
|
*/
|
|
tenant: {
|
|
relation: Model.BelongsToOneRelation,
|
|
modelClass: TenantModel,
|
|
join: {
|
|
from: 'users.tenantId',
|
|
to: 'tenants.id',
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|