feat: Attachment files system.

This commit is contained in:
Ahmed Bouhuolia
2020-05-04 05:11:44 +02:00
parent a807cf6bb8
commit 7f06e3781c
35 changed files with 757 additions and 179 deletions

View File

@@ -1,3 +1,4 @@
import { Model } from 'objection';
import TenantModel from '@/models/TenantModel';
export default class ManualJournal extends TenantModel {
@@ -7,4 +8,26 @@ export default class ManualJournal extends TenantModel {
static get tableName() {
return 'manual_journals';
}
/**
* 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',
}
}
};
}
}

View File

@@ -0,0 +1,10 @@
import TenantModel from '@/models/TenantModel';
export default class MediaLink extends TenantModel {
/**
* Table name
*/
static get tableName() {
return 'media_links';
}
}