2018-09-29 19:39:09 +00:00
|
|
|
const _ = require('lodash')
|
|
|
|
const graphHelper = require('../../helpers/graph')
|
|
|
|
|
|
|
|
/* global WIKI */
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
Query: {
|
|
|
|
async navigation() { return {} }
|
|
|
|
},
|
|
|
|
Mutation: {
|
|
|
|
async navigation() { return {} }
|
|
|
|
},
|
|
|
|
NavigationQuery: {
|
|
|
|
async tree(obj, args, context, info) {
|
2018-10-22 02:25:17 +00:00
|
|
|
return WIKI.models.navigation.getTree()
|
2018-09-29 19:39:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
NavigationMutation: {
|
|
|
|
async updateTree(obj, args, context) {
|
|
|
|
try {
|
2018-10-22 02:25:17 +00:00
|
|
|
await WIKI.models.navigation.query().patch({
|
|
|
|
config: args.tree
|
|
|
|
}).where('key', 'site')
|
|
|
|
|
2018-09-29 19:39:09 +00:00
|
|
|
return {
|
|
|
|
responseResult: graphHelper.generateSuccess('Navigation updated successfully')
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
return graphHelper.generateError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|