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

  1. const _ = require('lodash')
  2. const graphHelper = require('../../helpers/graph')
  3. /* global WIKI */
  4. module.exports = {
  5. Query: {
  6. async navigation() { return {} }
  7. },
  8. Mutation: {
  9. async navigation() { return {} }
  10. },
  11. NavigationQuery: {
  12. async tree(obj, args, context, info) {
  13. return WIKI.models.navigation.getTree()
  14. }
  15. },
  16. NavigationMutation: {
  17. async updateTree(obj, args, context) {
  18. try {
  19. await WIKI.models.navigation.query().patch({
  20. config: args.tree
  21. }).where('key', 'site')
  22. return {
  23. responseResult: graphHelper.generateSuccess('Navigation updated successfully')
  24. }
  25. } catch (err) {
  26. return graphHelper.generateError(err)
  27. }
  28. }
  29. }
  30. }