mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
refactor: manual journal.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Model } from 'objection';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
import { AccountTransaction } from 'models';
|
||||
|
||||
export default class ManualJournal extends TenantModel {
|
||||
/**
|
||||
@@ -21,8 +22,20 @@ export default class ManualJournal extends TenantModel {
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const Media = require('models/Media');
|
||||
const AccountTransaction = require('models/AccountTransaction');
|
||||
|
||||
return {
|
||||
entries: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: this.relationBindKnex(AccountTransaction.default),
|
||||
join: {
|
||||
from: 'manual_journals.id',
|
||||
to: 'accounts_transactions.referenceId',
|
||||
},
|
||||
filter: (query) => {
|
||||
query.where('referenceType', 'Journal');
|
||||
},
|
||||
},
|
||||
media: {
|
||||
relation: Model.ManyToManyRelation,
|
||||
modelClass: this.relationBindKnex(Media.default),
|
||||
|
||||
Reference in New Issue
Block a user