wikijs-fork/server/models/pageLinks.js

35 lines
660 B
JavaScript
Raw Permalink Normal View History

2019-09-03 02:18:59 +00:00
const Model = require('objection').Model
/**
* Users model
*/
module.exports = class PageLink extends Model {
static get tableName() { return 'pageLinks' }
static get jsonSchema () {
return {
type: 'object',
required: ['path', 'localeCode'],
properties: {
id: {type: 'integer'},
path: {type: 'string'},
localeCode: {type: 'string'}
}
}
}
static get relationMappings() {
return {
page: {
relation: Model.BelongsToOneRelation,
modelClass: require('./pages'),
join: {
from: 'pageLinks.pageId',
to: 'pages.id'
}
}
}
}
}