You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wiki/server/models/pageLinks.mjs

37 lines
657 B

import { Model } from 'objection'
import { Page } from './pages.mjs'
/**
* Users model
*/
export class PageLink extends Model {
static get tableName() { return 'pageLinks' }
static get jsonSchema () {
return {
type: 'object',
required: ['path', 'locale'],
properties: {
id: {type: 'integer'},
path: {type: 'string'},
locale: {type: 'string'}
}
}
}
static get relationMappings() {
return {
page: {
relation: Model.BelongsToOneRelation,
modelClass: Page,
join: {
from: 'pageLinks.pageId',
to: 'pages.id'
}
}
}
}
}