mirror of
https://github.com/requarks/wiki.git
synced 2026-08-26 21:27:10 -05:00
37 lines
657 B
JavaScript
37 lines
657 B
JavaScript
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'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|