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.

34 lines
660 B

  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. }