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.

102 lines
1.9 KiB

  1. # ===============================================
  2. # USERS
  3. # ===============================================
  4. extend type Query {
  5. users: UserQuery
  6. }
  7. extend type Mutation {
  8. users: UserMutation
  9. }
  10. # -----------------------------------------------
  11. # QUERIES
  12. # -----------------------------------------------
  13. type UserQuery {
  14. list(
  15. filter: String
  16. orderBy: String
  17. ): [UserMinimal] @auth(requires: ["write:users", "manage:users", "manage:system"])
  18. search(
  19. query: String!
  20. ): [UserMinimal] @auth(requires: ["write:groups", "manage:groups", "write:users", "manage:users", "manage:system"])
  21. single(
  22. id: Int!
  23. ): User @auth(requires: ["manage:users", "manage:system"])
  24. }
  25. # -----------------------------------------------
  26. # MUTATIONS
  27. # -----------------------------------------------
  28. type UserMutation {
  29. create(
  30. email: String!
  31. name: String
  32. passwordRaw: String
  33. provider: String!
  34. providerId: String
  35. role: UserRole!
  36. ): UserResponse @auth(requires: ["write:users", "manage:users", "manage:system"])
  37. update(
  38. id: Int!
  39. email: String
  40. name: String
  41. provider: String
  42. providerId: String
  43. role: UserRole
  44. ): UserResponse @auth(requires: ["manage:users", "manage:system"])
  45. delete(
  46. id: Int!
  47. ): DefaultResponse @auth(requires: ["manage:users", "manage:system"])
  48. resetPassword(
  49. id: Int!
  50. ): DefaultResponse
  51. setPassword(
  52. id: Int!
  53. passwordRaw: String!
  54. ): DefaultResponse
  55. }
  56. # -----------------------------------------------
  57. # TYPES
  58. # -----------------------------------------------
  59. enum UserRole {
  60. guest
  61. user
  62. admin
  63. }
  64. type UserResponse {
  65. responseResult: ResponseStatus!
  66. user: User
  67. }
  68. type UserMinimal {
  69. id: Int!
  70. name: String!
  71. email: String!
  72. providerKey: String!
  73. createdAt: Date!
  74. }
  75. type User {
  76. id: Int!
  77. name: String!
  78. email: String!
  79. providerKey: String!
  80. providerId: String
  81. role: UserRole!
  82. createdAt: Date!
  83. updatedAt: Date!
  84. groups: [Group]
  85. }