This repository has been archived on 2026-06-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
auracle-api/models/spell-model.js
2021-07-18 15:48:01 +02:00

24 lines
646 B
JavaScript

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);