types.graphql 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. comments: [Comment]
  46. tags: [Tag]
  47. }
  48. type File implements Base {
  49. id: Int!
  50. createdAt: Date
  51. updatedAt: Date
  52. category: FileType!
  53. mime: String!
  54. extra: String
  55. filename: String!
  56. basename: String!
  57. filesize: Int!
  58. folder: Folder
  59. }
  60. type Folder implements Base {
  61. id: Int!
  62. createdAt: Date
  63. updatedAt: Date
  64. name: String!
  65. files: [File]
  66. }
  67. type Group implements Base {
  68. id: Int!
  69. createdAt: Date
  70. updatedAt: Date
  71. name: String!
  72. users: [User]
  73. rights: [Right]
  74. }
  75. type Right implements Base {
  76. id: Int!
  77. createdAt: Date
  78. updatedAt: Date
  79. path: String!
  80. role: RightRole!
  81. exact: Boolean!
  82. allow: Boolean!
  83. group: Group!
  84. }
  85. type Setting implements Base {
  86. id: Int!
  87. createdAt: Date
  88. updatedAt: Date
  89. key: String!
  90. config: String!
  91. }
  92. # Tags are attached to one or more documents
  93. type Tag implements Base {
  94. id: Int!
  95. createdAt: Date
  96. updatedAt: Date
  97. key: String!
  98. documents: [Document]
  99. }
  100. # A User
  101. type User implements Base {
  102. id: Int!
  103. createdAt: Date
  104. updatedAt: Date
  105. email: String!
  106. provider: String!
  107. providerId: String
  108. name: String
  109. role: UserRole!
  110. groups: [Group]
  111. }
  112. type OperationResult {
  113. succeded: Boolean!
  114. message: String
  115. }
  116. # Query (Read)
  117. type Query {
  118. comments(id: Int): [Comment]
  119. documents(id: Int, path: String): [Document]
  120. files(id: Int): [File]
  121. folders(id: Int, name: String): [Folder]
  122. groups(id: Int, name: String): [Group]
  123. rights(id: Int): [Right]
  124. settings(key: String): [Setting]
  125. tags(key: String): [Tag]
  126. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  127. }
  128. # Mutations (Create, Update, Delete)
  129. type Mutation {
  130. addRightToGroup(
  131. groupId: Int!
  132. path: String!
  133. role: RightRole!
  134. exact: Boolean!
  135. allow: Boolean!
  136. ): Right
  137. assignTagToDocument(
  138. tagId: Int!
  139. documentId: Int!
  140. ): OperationResult
  141. assignUserToGroup(
  142. userId: Int!
  143. groupId: Int!
  144. ): OperationResult
  145. createComment(
  146. userId: Int!
  147. documentId: Int!
  148. content: String!
  149. ): Comment
  150. createDocument(
  151. path: String!
  152. title: String!
  153. subtitle: String
  154. ): Document
  155. createFolder(
  156. name: String!
  157. ): Folder
  158. createGroup(
  159. name: String!
  160. ): Group
  161. createTag(
  162. name: String!
  163. ): Tag
  164. createUser(
  165. email: String!
  166. name: String
  167. passwordRaw: String
  168. provider: String!
  169. providerId: String
  170. role: UserRole!
  171. ): User
  172. deleteComment(
  173. id: Int!
  174. ): OperationResult
  175. deleteDocument(
  176. id: Int!
  177. ): OperationResult
  178. deleteFolder(
  179. id: Int!
  180. ): OperationResult
  181. deleteGroup(
  182. id: Int!
  183. ): OperationResult
  184. deleteTag(
  185. id: Int!
  186. ): OperationResult
  187. deleteUser(
  188. id: Int!
  189. ): OperationResult
  190. modifyComment(
  191. id: Int!
  192. content: String!
  193. ): Document
  194. modifyDocument(
  195. id: Int!
  196. title: String
  197. subtitle: String
  198. ): Document
  199. modifyUser(
  200. id: Int!
  201. email: String
  202. name: String
  203. provider: String
  204. providerId: String
  205. role: UserRole
  206. ): User
  207. modifyRight(
  208. id: Int!
  209. path: String
  210. role: RightRole
  211. exact: Boolean
  212. allow: Boolean
  213. ): Right
  214. moveDocument(
  215. id: Int!
  216. path: String!
  217. ): OperationResult
  218. renameFolder(
  219. id: Int!
  220. name: String!
  221. ): OperationResult
  222. renameGroup(
  223. id: Int!
  224. name: String!
  225. ): OperationResult
  226. renameTag(
  227. id: Int!
  228. key: String!
  229. ): OperationResult
  230. removeTagFromDocument(
  231. tagId: Int!
  232. documentId: Int!
  233. ): OperationResult
  234. removeRightFromGroup(
  235. rightId: Int!
  236. ): OperationResult
  237. removeUserFromGroup(
  238. userId: Int!
  239. groupId: Int!
  240. ): OperationResult
  241. resetUserPassword(
  242. id: Int!
  243. ): OperationResult
  244. setConfigEntry(
  245. key: String!
  246. value: String!
  247. ): OperationResult
  248. setUserPassword(
  249. id: Int!
  250. passwordRaw: String!
  251. ): OperationResult
  252. }