user.graphql 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. cvd: UserCvdChoices
  63. ): DefaultResponse
  64. uploadUserAvatar(
  65. id: UUID!
  66. image: Upload!
  67. ): DefaultResponse
  68. clearUserAvatar(
  69. id: UUID!
  70. ): DefaultResponse
  71. }
  72. # -----------------------------------------------
  73. # TYPES
  74. # -----------------------------------------------
  75. type UserResponse {
  76. operation: Operation
  77. user: User
  78. }
  79. type UserLastLogin {
  80. id: UUID
  81. name: String
  82. lastLoginAt: Date
  83. }
  84. type UserMinimal {
  85. id: UUID
  86. name: String
  87. email: String
  88. isSystem: Boolean
  89. isActive: Boolean
  90. createdAt: Date
  91. lastLoginAt: Date
  92. }
  93. type User {
  94. id: UUID
  95. name: String
  96. email: String
  97. auth: [UserAuth]
  98. hasAvatar: Boolean
  99. isSystem: Boolean
  100. isActive: Boolean
  101. isVerified: Boolean
  102. meta: JSON
  103. prefs: JSON
  104. createdAt: Date
  105. updatedAt: Date
  106. lastLoginAt: Date
  107. groups: [Group]
  108. }
  109. type UserAuth {
  110. authId: UUID
  111. authName: String
  112. strategyKey: String
  113. strategyIcon: String
  114. config: JSON
  115. }
  116. type UserTokenResponse {
  117. operation: Operation
  118. jwt: String
  119. }
  120. enum UserOrderBy {
  121. id
  122. email
  123. name
  124. createdAt
  125. updatedAt
  126. lastLoginAt
  127. }
  128. enum UserSiteAppearance {
  129. site
  130. light
  131. dark
  132. }
  133. enum UserCvdChoices {
  134. none
  135. protanopia
  136. deuteranopia
  137. tritanopia
  138. }
  139. input UserUpdateInput {
  140. email: String
  141. name: String
  142. newPassword: String
  143. groups: [UUID!]
  144. isActive: Boolean
  145. isVerified: Boolean
  146. meta: JSON
  147. prefs: JSON
  148. }