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.

46 lines
1.1 KiB

  1. const _ = require('lodash')
  2. const graphHelper = require('../../helpers/graph')
  3. /* global WIKI */
  4. module.exports = {
  5. Query: {
  6. async mail() { return {} }
  7. },
  8. Mutation: {
  9. async mail() { return {} }
  10. },
  11. MailQuery: {
  12. async config(obj, args, context, info) {
  13. return WIKI.config.mail
  14. }
  15. },
  16. MailMutation: {
  17. async updateConfig(obj, args, context) {
  18. try {
  19. WIKI.config.mail = {
  20. senderName: args.senderName,
  21. senderEmail: args.senderEmail,
  22. host: args.host,
  23. port: args.port,
  24. secure: args.secure,
  25. user: args.user,
  26. pass: args.pass,
  27. useDKIM: args.useDKIM,
  28. dkimDomainName: args.dkimDomainName,
  29. dkimKeySelector: args.dkimKeySelector,
  30. dkimPrivateKey: args.dkimPrivateKey,
  31. }
  32. await WIKI.configSvc.saveToDb(['mail'])
  33. WIKI.mail.init()
  34. return {
  35. responseResult: graphHelper.generateSuccess('Mail configuration updated successfully')
  36. }
  37. } catch (err) {
  38. return graphHelper.generateError(err)
  39. }
  40. }
  41. }
  42. }