WIP server side.

This commit is contained in:
Ahmed Bouhuolia
2020-01-22 02:09:45 +02:00
parent de905d7e7c
commit 488709088b
123 changed files with 14885 additions and 771 deletions

View File

@@ -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',
},
},
};
}
}