Moved code to /src folder

This commit is contained in:
Alexis
2021-07-18 16:08:03 +02:00
parent fbc38207f7
commit d977ce6551
41 changed files with 0 additions and 0 deletions

24
src/models/spell-model.js Normal file
View File

@@ -0,0 +1,24 @@
const bookshelf = require('../database/bookshelf').bookshelf;
require('./school-model');
require('./variable-model');
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' );
},
variables() {
return this.belongsToMany( 'Variable', 'spell_variable' );
},
ingredients() {
return this.belongsToMany( 'Ingredient', 'spell_ingredient' );
}
});
module.exports = bookshelf.model('Spell', Spell);