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.

45 lines
845 B

  1. /* global wiki */
  2. module.exports = {
  3. Query: {
  4. users(obj, args, context, info) {
  5. return wiki.db.User.findAll({ where: args })
  6. }
  7. },
  8. Mutation: {
  9. createUser(obj, args) {
  10. return wiki.db.User.create(args)
  11. },
  12. deleteUser(obj, args) {
  13. return wiki.db.User.destroy({
  14. where: {
  15. id: args.id
  16. },
  17. limit: 1
  18. })
  19. },
  20. modifyUser(obj, args) {
  21. return wiki.db.User.update({
  22. email: args.email,
  23. name: args.name,
  24. provider: args.provider,
  25. providerId: args.providerId,
  26. role: args.role
  27. }, {
  28. where: { id: args.id }
  29. })
  30. },
  31. resetUserPassword(obj, args) {
  32. return false
  33. },
  34. setUserPassword(obj, args) {
  35. return false
  36. }
  37. },
  38. User: {
  39. groups(usr) {
  40. return usr.getGroups()
  41. }
  42. }
  43. }