user.graphql 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. userPermissions: [String]
  18. userPermissionsAtPath(
  19. siteId: UUID!
  20. path: String!
  21. ): [String]
  22. }
  23. extend type Mutation {
  24. createUser(
  25. email: String!
  26. name: String!
  27. password: String!
  28. groups: [UUID]!
  29. mustChangePassword: Boolean!
  30. sendWelcomeEmail: Boolean!
  31. ): UserResponse
  32. updateUser(
  33. id: UUID!
  34. patch: UserUpdateInput!
  35. ): DefaultResponse
  36. deleteUser(
  37. id: UUID!
  38. replaceId: UUID!
  39. ): DefaultResponse
  40. verifyUser(
  41. id: UUID!
  42. ): DefaultResponse
  43. activateUser(
  44. id: UUID!
  45. ): DefaultResponse
  46. deactivateUser(
  47. id: UUID!
  48. ): DefaultResponse
  49. enableUserTFA(
  50. id: UUID!
  51. ): DefaultResponse
  52. disableUserTFA(
  53. id: UUID!
  54. ): DefaultResponse
  55. resetUserPassword(
  56. id: Int!
  57. ): DefaultResponse
  58. updateProfile(
  59. name: String
  60. location: String
  61. jobTitle: String
  62. pronouns: String
  63. timezone: String
  64. dateFormat: String
  65. timeFormat: String
  66. appearance: UserSiteAppearance
  67. cvd: UserCvdChoices
  68. ): DefaultResponse
  69. uploadUserAvatar(
  70. id: UUID!
  71. image: Upload!
  72. ): DefaultResponse
  73. clearUserAvatar(
  74. id: UUID!
  75. ): DefaultResponse
  76. }
  77. # -----------------------------------------------
  78. # TYPES
  79. # -----------------------------------------------
  80. type UserResponse {
  81. operation: Operation
  82. user: User
  83. }
  84. type UserLastLogin {
  85. id: UUID
  86. name: String
  87. lastLoginAt: Date
  88. }
  89. type UserMinimal {
  90. id: UUID
  91. name: String
  92. email: String
  93. isSystem: Boolean
  94. isActive: Boolean
  95. createdAt: Date
  96. lastLoginAt: Date
  97. }
  98. type User {
  99. id: UUID
  100. name: String
  101. email: String
  102. auth: [UserAuth]
  103. hasAvatar: Boolean
  104. isSystem: Boolean
  105. isActive: Boolean
  106. isVerified: Boolean
  107. meta: JSON
  108. prefs: JSON
  109. createdAt: Date
  110. updatedAt: Date
  111. lastLoginAt: Date
  112. groups: [Group]
  113. }
  114. type UserAuth {
  115. authId: UUID
  116. authName: String
  117. strategyKey: String
  118. strategyIcon: String
  119. config: JSON
  120. }
  121. type UserTokenResponse {
  122. operation: Operation
  123. jwt: String
  124. }
  125. enum UserOrderBy {
  126. id
  127. email
  128. name
  129. createdAt
  130. updatedAt
  131. lastLoginAt
  132. }
  133. enum UserSiteAppearance {
  134. site
  135. light
  136. dark
  137. }
  138. enum UserCvdChoices {
  139. none
  140. protanopia
  141. deuteranopia
  142. tritanopia
  143. }
  144. input UserUpdateInput {
  145. email: String
  146. name: String
  147. newPassword: String
  148. groups: [UUID!]
  149. isActive: Boolean
  150. isVerified: Boolean
  151. meta: JSON
  152. prefs: JSON
  153. }