mirror of https://github.com/Requarks/wiki.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
745 B
33 lines
745 B
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) {
|
|
return WIKI.models.navigation.getTree()
|
|
}
|
|
},
|
|
NavigationMutation: {
|
|
async updateTree(obj, args, context) {
|
|
try {
|
|
await WIKI.models.navigation.query().patch({
|
|
config: args.tree
|
|
}).where('key', 'site')
|
|
|
|
return {
|
|
responseResult: graphHelper.generateSuccess('Navigation updated successfully')
|
|
}
|
|
} catch (err) {
|
|
return graphHelper.generateError(err)
|
|
}
|
|
}
|
|
}
|
|
}
|