Files
bigcapital/packages/server/src/system/models/SystemPlaidItem.ts
2024-02-24 00:18:48 +02:00

50 lines
893 B
TypeScript

import { Model } from 'objection';
import SystemModel from '@/system/models/SystemModel';
export default class SystemPlaidItem extends SystemModel {
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 Tenant = require('system/models/Tenant');
return {
/**
* System user may belongs to tenant model.
*/
tenant: {
relation: Model.BelongsToOneRelation,
modelClass: Tenant.default,
join: {
from: 'users.tenantId',
to: 'tenants.id',
},
},
};
}
}