mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
WIP server side.
This commit is contained in:
@@ -1,21 +1,29 @@
|
||||
import bookshelf from './bookshelf';
|
||||
|
||||
const AccountBalance = bookshelf.Model.extend({
|
||||
import { Model } from 'objection';
|
||||
import BaseModel from '@/models/Model';
|
||||
|
||||
export default class AccountBalance extends BaseModel {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
tableName: 'account_balance',
|
||||
static get tableName() {
|
||||
return 'account_balances';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp columns.
|
||||
* Relationship mapping.
|
||||
*/
|
||||
hasTimestamps: false,
|
||||
static get relationMappings() {
|
||||
const Account = require('@/models/Account');
|
||||
|
||||
|
||||
account() {
|
||||
return this.belongsTo('Account', 'account_id');
|
||||
},
|
||||
});
|
||||
|
||||
export default bookshelf.model('AccountBalance', AccountBalance);
|
||||
return {
|
||||
account: {
|
||||
relation: Model.BelongsToOneRelation,
|
||||
modelClass: Account.default,
|
||||
join: {
|
||||
from: 'account_balance.account_id',
|
||||
to: 'accounts.id',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user