mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 11:50:31 +00:00
37 lines
659 B
TypeScript
37 lines
659 B
TypeScript
import { Model } from 'objection';
|
|
import TenantModel from 'models/TenantModel';
|
|
|
|
export default class Media extends TenantModel {
|
|
/**
|
|
* Table name
|
|
*/
|
|
static get tableName() {
|
|
return 'media';
|
|
}
|
|
|
|
/**
|
|
* Model timestamps.
|
|
*/
|
|
get timestamps() {
|
|
return ['createdAt', 'updatedAt'];
|
|
}
|
|
|
|
/**
|
|
* Relationship mapping.
|
|
*/
|
|
static get relationMappings() {
|
|
const MediaLink = require('models/MediaLink');
|
|
|
|
return {
|
|
links: {
|
|
relation: Model.HasManyRelation,
|
|
modelClass: MediaLink.default,
|
|
join: {
|
|
from: 'media.id',
|
|
to: 'media_links.media_id',
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|