- Added getspells from variables, ingredients, and schools

This commit is contained in:
Alexis
2020-06-09 19:32:01 +02:00
parent 6d67ebff95
commit 3568a51627
7 changed files with 122 additions and 2 deletions

View File

@@ -49,6 +49,21 @@ class SchoolRepository {
})
}
getSpellsFromOne(id) {
return new Promise((resolve, reject) => {
model.forge()
.where({ 'id' : id })
.fetch({ withRelated: ['spells', 'meta_schools']})
.then(v => {
resolve(v.toJSON({ omitPivot: true }))
})
.catch(err => {
console.log(err)
reject(new HttpError(500, "Couldn't get school"))
})
})
}
addOne(s) {
return new Promise((resolve, reject) => {
// Checks if body exists and if the model fits, and throws errors if it doesn't