pageLinks.js 660 B

12345678910111213141516171819202122232425262728293031323334
  1. const Model = require('objection').Model
  2. /**
  3. * Users model
  4. */
  5. module.exports = class PageLink extends Model {
  6. static get tableName() { return 'pageLinks' }
  7. static get jsonSchema () {
  8. return {
  9. type: 'object',
  10. required: ['path', 'localeCode'],
  11. properties: {
  12. id: {type: 'integer'},
  13. path: {type: 'string'},
  14. localeCode: {type: 'string'}
  15. }
  16. }
  17. }
  18. static get relationMappings() {
  19. return {
  20. page: {
  21. relation: Model.BelongsToOneRelation,
  22. modelClass: require('./pages'),
  23. join: {
  24. from: 'pageLinks.pageId',
  25. to: 'pages.id'
  26. }
  27. }
  28. }
  29. }
  30. }