Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from: 'Person.pid',
to: 'Person.id'
}
},
children: {
relation: objection.HasManyRelation,
modelClass: Person,
join: {
from: 'Person.id',
to: 'Person.pid'
}
},
pets: {
relation: objection.HasManyRelation,
modelClass: Animal,
join: {
from: 'Person.id',
to: 'Animal.ownerId'
}
},
movies: {
relation: objection.ManyToManyRelation,
modelClass: Movie,
join: {
from: 'Person.id',
through: {
from: 'Person_Movie.actorId',
to: 'Person_Movie.movieId'
},
Person.prototype.fullName = function() {
return this.firstName + ' ' + this.lastName;
};
Person.relationMappings = {
parent: {
relation: objection.BelongsToOneRelation,
modelClass: Person,
join: {
from: 'Person.pid',
to: 'Person.id'
}
},
pets: {
relation: objection.HasManyRelation,
modelClass: Animal,
join: {
from: 'Person.id',
to: 'Animal.ownerId'
}
},
movies: {
relation: objection.ManyToManyRelation,
modelClass: Movie,
join: {
from: 'Person.id',
through: {
from: 'Person_Movie.actorId',
to: 'Person_Movie.movieId'
},
static get relationMappings() {
return {
parent: {
relation: objection.BelongsToOneRelation,
modelClass: Person,
join: {
from: 'Person.pid',
to: 'Person.id'
}
},
pets: {
relation: objection.HasManyRelation,
modelClass: Animal,
join: {
from: 'Person.id',
to: 'Animal.ownerId'
}
},
movies: {
relation: objection.ManyToManyRelation,
modelClass: Movie,
join: {
from: 'Person.id',
through: {
from: 'Person_Movie.actorId',
to: 'Person_Movie.movieId'
},
Person.prototype.fullName = function () {
return this.firstName + ' ' + this.lastName;
};
Person.relationMappings = {
parent: {
relation: objection.BelongsToOneRelation,
modelClass: Person,
join: {
from: 'Person.pid',
to: 'Person.id'
}
},
children: {
relation: objection.HasManyRelation,
modelClass: Person,
join: {
from: 'Person.id',
to: 'Person.pid'
}
},
pets: {
relation: objection.HasManyRelation,
modelClass: Animal,
join: {
from: 'Person.id',
to: 'Animal.ownerId'
}
},