user.graphql 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # ===============================================
  2. # USERS
  3. # ===============================================
  4. extend type Query {
  5. users (
  6. page: Int
  7. pageSize: Int
  8. orderBy: UserOrderBy
  9. orderByDirection: OrderByDirection
  10. # Filter by name / email
  11. filter: String
  12. ): [UserMinimal]
  13. userById(
  14. id: UUID!
  15. ): User
  16. lastLogins: [UserLastLogin]
  17. }
  18. extend type Mutation {
  19. createUser(
  20. email: String!
  21. name: String!
  22. password: String!
  23. groups: [UUID]!
  24. mustChangePassword: Boolean!
  25. sendWelcomeEmail: Boolean!
  26. ): UserResponse
  27. updateUser(
  28. id: UUID!
  29. patch: UserUpdateInput!
  30. ): DefaultResponse
  31. deleteUser(
  32. id: UUID!
  33. replaceId: UUID!
  34. ): DefaultResponse
  35. verifyUser(
  36. id: UUID!
  37. ): DefaultResponse
  38. activateUser(
  39. id: UUID!
  40. ): DefaultResponse
  41. deactivateUser(
  42. id: UUID!
  43. ): DefaultResponse
  44. enableUserTFA(
  45. id: UUID!
  46. ): DefaultResponse
  47. disableUserTFA(
  48. id: UUID!
  49. ): DefaultResponse
  50. resetUserPassword(
  51. id: Int!
  52. ): DefaultResponse
  53. updateProfile(
  54. name: String
  55. location: String
  56. jobTitle: String
  57. pronouns: String
  58. timezone: String
  59. dateFormat: String
  60. timeFormat: String
  61. appearance: UserSiteAppearance
  62. ): DefaultResponse
  63. uploadUserAvatar(
  64. id: UUID!
  65. image: Upload!
  66. ): DefaultResponse
  67. clearUserAvatar(
  68. id: UUID!
  69. ): DefaultResponse
  70. }
  71. # -----------------------------------------------
  72. # TYPES
  73. # -----------------------------------------------
  74. type UserResponse {
  75. operation: Operation
  76. user: User
  77. }
  78. type UserLastLogin {
  79. id: UUID
  80. name: String
  81. lastLoginAt: Date
  82. }
  83. type UserMinimal {
  84. id: UUID
  85. name: String
  86. email: String
  87. isSystem: Boolean
  88. isActive: Boolean
  89. createdAt: Date
  90. lastLoginAt: Date
  91. }
  92. type User {
  93. id: UUID
  94. name: String
  95. email: String
  96. auth: [UserAuth]
  97. hasAvatar: Boolean
  98. isSystem: Boolean
  99. isActive: Boolean
  100. isVerified: Boolean
  101. meta: JSON
  102. prefs: JSON
  103. createdAt: Date
  104. updatedAt: Date
  105. lastLoginAt: Date
  106. groups: [Group]
  107. }
  108. type UserAuth {
  109. authId: UUID
  110. authName: String
  111. strategyKey: String
  112. strategyIcon: String
  113. config: JSON
  114. }
  115. type UserTokenResponse {
  116. operation: Operation
  117. jwt: String
  118. }
  119. enum UserOrderBy {
  120. id
  121. email
  122. name
  123. createdAt
  124. updatedAt
  125. lastLoginAt
  126. }
  127. enum UserSiteAppearance {
  128. site
  129. light
  130. dark
  131. }
  132. input UserUpdateInput {
  133. email: String
  134. name: String
  135. newPassword: String
  136. groups: [UUID!]
  137. isActive: Boolean
  138. isVerified: Boolean
  139. meta: JSON
  140. prefs: JSON
  141. }