Added getSpellsFromUser() method

This commit is contained in:
Alexis
2021-01-01 22:07:22 +01:00
parent 1759f71876
commit b313393af6
5 changed files with 60 additions and 12 deletions

View File

@@ -7,14 +7,18 @@ require('./ingredient-model')
let Spell = bookshelf.Model.extend({
tableName: 'spell',
hidden: [ 'author_id' ],
author() {
return this.belongsTo( 'User', 'author_id' );
},
schools() {
return this.belongsToMany( 'School', 'spell_school' )
return this.belongsToMany( 'School', 'spell_school' );
},
variables() {
return this.belongsToMany( 'Variable', 'spell_variable' )
return this.belongsToMany( 'Variable', 'spell_variable' );
},
ingredients() {
return this.belongsToMany( 'Ingredient', 'spell_ingredient' )
return this.belongsToMany( 'Ingredient', 'spell_ingredient' );
}
})