models/Person.js
// This object defined the relations to other models.
This object defined the relations to other models.
This object defined the relations to other models .
static get relationMappings() {
    return {
      pets: {
        relation: Model.HasManyRelation,
        modelClass: Animal,
        join: {
          from: 'Person.id',
          to: 'Animal.ownerId'
        }
      },
      movies: {
        relation: Model.ManyToManyRelation,
        modelClass: Movie,
        join: {
          from: 'Person.id',
          through: {
            from: 'Person_Movie.personId',
            to: 'Person_Movie.movieId'
          },
          to: 'Movie.id'
        }
      },
      children: {
        relation: Model.HasManyRelation,
        modelClass: Person,
        join: {
          from: 'Person.id',
          to: 'Person.parentId'
        }
      }
    };
  }
static get relationMappings ( ) { return { pets : { relation : Model . HasManyRelation , modelClass : Animal , join : { from : 'Person.id' , to : 'Animal.ownerId' } } , movies : { relation : Model . ManyToManyRelation , modelClass : Movie , join : { from : 'Person.id' , through : { from : 'Person_Movie.personId' , to : 'Person_Movie.movieId' } , to : 'Movie.id' } } , children : { relation : Model . HasManyRelation , modelClass : Person , join : { from : 'Person.id' , to : 'Person.parentId' } } } ; }
This object defined the relations to other models.
This object defined the relations to other models .
// The related model. This can be either a Model subclass constructor or an // absolute file path to a module that exports one. // ManyToMany relation needs the `through` object to describe the join table.