types.graphql 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. # SCALARS
  2. scalar Date
  3. # ENUMS
  4. enum UserRole {
  5. guest
  6. user
  7. admin
  8. }
  9. enum FileType {
  10. binary
  11. image
  12. }
  13. enum RightRole {
  14. read
  15. write
  16. manage
  17. }
  18. # INTERFACES
  19. interface Base {
  20. id: Int!
  21. createdAt: Date
  22. updatedAt: Date
  23. }
  24. # TYPES
  25. type Comment implements Base {
  26. id: Int!
  27. createdAt: Date
  28. updatedAt: Date
  29. content: String
  30. document: Document!
  31. author: User!
  32. }
  33. type Document implements Base {
  34. id: Int!
  35. createdAt: Date
  36. updatedAt: Date
  37. path: String!
  38. title: String!
  39. subtitle: String
  40. parentPath: String
  41. parentTitle: String
  42. isDirectory: Boolean!
  43. isEntry: Boolean!
  44. searchContent: String
  45. tags: [Tag]
  46. }
  47. type File implements Base {
  48. id: Int!
  49. createdAt: Date
  50. updatedAt: Date
  51. category: FileType!
  52. mime: String!
  53. extra: String
  54. filename: String!
  55. basename: String!
  56. filesize: Int!
  57. folder: Folder
  58. }
  59. type Folder implements Base {
  60. id: Int!
  61. createdAt: Date
  62. updatedAt: Date
  63. name: String!
  64. files: [File]
  65. }
  66. type Group implements Base {
  67. id: Int!
  68. createdAt: Date
  69. updatedAt: Date
  70. name: String!
  71. users: [User]
  72. rights: [Right]
  73. }
  74. type Right implements Base {
  75. id: Int!
  76. createdAt: Date
  77. updatedAt: Date
  78. path: String!
  79. role: RightRole!
  80. exact: Boolean!
  81. allow: Boolean!
  82. }
  83. type Setting implements Base {
  84. id: Int!
  85. createdAt: Date
  86. updatedAt: Date
  87. key: String!
  88. config: String!
  89. }
  90. # Tags are attached to one or more documents
  91. type Tag implements Base {
  92. id: Int!
  93. createdAt: Date
  94. updatedAt: Date
  95. key: String!
  96. documents: [Document]
  97. }
  98. # A User
  99. type User implements Base {
  100. id: Int!
  101. createdAt: Date
  102. updatedAt: Date
  103. email: String!
  104. provider: String!
  105. providerId: String
  106. name: String
  107. role: UserRole!
  108. groups: [Group]
  109. }
  110. type OperationResult {
  111. succeded: Boolean!
  112. message: String
  113. }
  114. # Query (Read)
  115. type Query {
  116. comments(id: Int): [Comment]
  117. documents(id: Int, path: String): [Document]
  118. files(id: Int): [File]
  119. folders(id: Int, name: String): [Folder]
  120. groups(id: Int, name: String): [Group]
  121. rights(id: Int): [Right]
  122. settings(key: String): [Setting]
  123. tags(key: String): [Tag]
  124. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  125. }
  126. # Mutations (Create, Update, Delete)
  127. type Mutation {
  128. assignTagToDocument(
  129. tagId: Int!
  130. documentId: Int!
  131. ): OperationResult
  132. assignUserToGroup(
  133. userId: Int!
  134. groupId: Int!
  135. ): OperationResult
  136. createDocument(
  137. path: String!
  138. title: String!
  139. subtitle: String
  140. ): Document
  141. createFolder(
  142. name: String!
  143. ): Folder
  144. createGroup(
  145. name: String!
  146. ): Group
  147. createTag(
  148. name: String!
  149. ): Tag
  150. createUser(
  151. email: String!
  152. name: String
  153. passwordRaw: String
  154. provider: String!
  155. providerId: String
  156. role: UserRole!
  157. ): User
  158. deleteDocument(
  159. id: Int!
  160. ): OperationResult
  161. deleteFolder(
  162. id: Int!
  163. ): OperationResult
  164. deleteGroup(
  165. id: Int!
  166. ): OperationResult
  167. deleteTag(
  168. id: Int!
  169. ): OperationResult
  170. deleteUser(
  171. id: Int!
  172. ): OperationResult
  173. modifyDocument(
  174. id: Int!
  175. title: String
  176. subtitle: String
  177. ): Document
  178. modifyUser(
  179. id: Int!
  180. email: String
  181. name: String
  182. provider: String
  183. providerId: String
  184. role: UserRole
  185. ): User
  186. moveDocument(
  187. id: Int!
  188. path: String!
  189. ): OperationResult
  190. renameFolder(
  191. id: Int!
  192. name: String!
  193. ): OperationResult
  194. renameGroup(
  195. id: Int!
  196. name: String!
  197. ): OperationResult
  198. renameTag(
  199. id: Int!
  200. name: String!
  201. ): OperationResult
  202. removeTagFromDocument(
  203. tagId: Int!
  204. documentId: Int!
  205. ): OperationResult
  206. removeUserFromGroup(
  207. userId: Int!
  208. groupId: Int!
  209. ): OperationResult
  210. resetUserPassword(
  211. id: Int!
  212. ): OperationResult
  213. setUserPassword(
  214. id: Int!
  215. passwordRaw: String!
  216. ): OperationResult
  217. }