types.graphql 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. type Translation {
  101. key: String!
  102. value: String!
  103. }
  104. # A User
  105. type User implements Base {
  106. id: Int!
  107. createdAt: Date
  108. updatedAt: Date
  109. email: String!
  110. provider: String!
  111. providerId: String
  112. name: String
  113. role: UserRole!
  114. groups: [Group]
  115. }
  116. type OperationResult {
  117. succeded: Boolean!
  118. message: String
  119. }
  120. # Query (Read)
  121. type Query {
  122. comments(id: Int): [Comment]
  123. documents(id: Int, path: String): [Document]
  124. files(id: Int): [File]
  125. folders(id: Int, name: String): [Folder]
  126. groups(id: Int, name: String): [Group]
  127. rights(id: Int): [Right]
  128. settings(key: String): [Setting]
  129. tags(key: String): [Tag]
  130. translations(locale: String!, namespace: String!): [Translation]
  131. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  132. }
  133. # Mutations (Create, Update, Delete)
  134. type Mutation {
  135. addRightToGroup(
  136. groupId: Int!
  137. path: String!
  138. role: RightRole!
  139. exact: Boolean!
  140. allow: Boolean!
  141. ): Right
  142. assignTagToDocument(
  143. tagId: Int!
  144. documentId: Int!
  145. ): OperationResult
  146. assignUserToGroup(
  147. userId: Int!
  148. groupId: Int!
  149. ): OperationResult
  150. createComment(
  151. userId: Int!
  152. documentId: Int!
  153. content: String!
  154. ): Comment
  155. createDocument(
  156. path: String!
  157. title: String!
  158. subtitle: String
  159. ): Document
  160. createFolder(
  161. name: String!
  162. ): Folder
  163. createGroup(
  164. name: String!
  165. ): Group
  166. createTag(
  167. name: String!
  168. ): Tag
  169. createUser(
  170. email: String!
  171. name: String
  172. passwordRaw: String
  173. provider: String!
  174. providerId: String
  175. role: UserRole!
  176. ): User
  177. deleteComment(
  178. id: Int!
  179. ): OperationResult
  180. deleteDocument(
  181. id: Int!
  182. ): OperationResult
  183. deleteFile(
  184. id: Int!
  185. ): OperationResult
  186. deleteFolder(
  187. id: Int!
  188. ): OperationResult
  189. deleteGroup(
  190. id: Int!
  191. ): OperationResult
  192. deleteTag(
  193. id: Int!
  194. ): OperationResult
  195. deleteUser(
  196. id: Int!
  197. ): OperationResult
  198. modifyComment(
  199. id: Int!
  200. content: String!
  201. ): Document
  202. modifyDocument(
  203. id: Int!
  204. title: String
  205. subtitle: String
  206. ): Document
  207. modifyUser(
  208. id: Int!
  209. email: String
  210. name: String
  211. provider: String
  212. providerId: String
  213. role: UserRole
  214. ): User
  215. modifyRight(
  216. id: Int!
  217. path: String
  218. role: RightRole
  219. exact: Boolean
  220. allow: Boolean
  221. ): Right
  222. moveDocument(
  223. id: Int!
  224. path: String!
  225. ): OperationResult
  226. moveFile(
  227. id: Int!
  228. folderId: Int!
  229. ): OperationResult
  230. renameFile(
  231. id: Int!
  232. name: String!
  233. ): OperationResult
  234. renameFolder(
  235. id: Int!
  236. name: String!
  237. ): OperationResult
  238. renameGroup(
  239. id: Int!
  240. name: String!
  241. ): OperationResult
  242. renameTag(
  243. id: Int!
  244. key: String!
  245. ): OperationResult
  246. removeTagFromDocument(
  247. tagId: Int!
  248. documentId: Int!
  249. ): OperationResult
  250. removeRightFromGroup(
  251. rightId: Int!
  252. ): OperationResult
  253. removeUserFromGroup(
  254. userId: Int!
  255. groupId: Int!
  256. ): OperationResult
  257. resetUserPassword(
  258. id: Int!
  259. ): OperationResult
  260. setConfigEntry(
  261. key: String!
  262. value: String!
  263. ): OperationResult
  264. setUserPassword(
  265. id: Int!
  266. passwordRaw: String!
  267. ): OperationResult
  268. uploadFile(
  269. category: FileType!
  270. filename: String!
  271. ): File
  272. }