user.graphql 2.9 KB

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