Files
bigcapital/server/src/models/ManualJournal.js
Ahmed Bouhuolia a22c8395f3 feat: remove path alias.
feat: remove Webpack and depend on nodemon.
feat: refactoring expenses.
feat: optimize system users with caching.
feat: architecture tenant optimize.
2020-09-15 00:51:39 +02:00

41 lines
804 B
JavaScript

import { Model } from 'objection';
import TenantModel from 'models/TenantModel';
export default class ManualJournal extends TenantModel {
/**
* Table name.
*/
static get tableName() {
return 'manual_journals';
}
/**
* Model timestamps.
*/
get timestamps() {
return ['createdAt', 'updatedAt'];
}
/**
* Relationship mapping.
*/
static get relationMappings() {
const Media = require('models/Media');
return {
media: {
relation: Model.ManyToManyRelation,
modelClass: this.relationBindKnex(Media.default),
join: {
from: 'manual_journals.id',
through: {
from: 'media_links.model_id',
to: 'media_links.media_id',
},
to: 'media.id',
}
}
};
}
}