common.graphql 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. # ENUMS
  2. enum UserRole {
  3. guest
  4. user
  5. admin
  6. }
  7. enum FileType {
  8. binary
  9. image
  10. }
  11. enum RightRole {
  12. read
  13. write
  14. manage
  15. }
  16. # INTERFACES
  17. interface Base {
  18. id: Int!
  19. createdAt: Date
  20. updatedAt: Date
  21. }
  22. # TYPES
  23. type Comment implements Base {
  24. id: Int!
  25. createdAt: Date
  26. updatedAt: Date
  27. content: String
  28. document: Document!
  29. author: User!
  30. }
  31. type Document implements Base {
  32. id: Int!
  33. createdAt: Date
  34. updatedAt: Date
  35. path: String!
  36. title: String!
  37. subtitle: String
  38. parentPath: String
  39. parentTitle: String
  40. isDirectory: Boolean!
  41. isEntry: Boolean!
  42. searchContent: String
  43. comments: [Comment]
  44. tags: [Tag]
  45. }
  46. type File implements Base {
  47. id: Int!
  48. createdAt: Date
  49. updatedAt: Date
  50. category: FileType!
  51. mime: String!
  52. extra: String
  53. filename: String!
  54. basename: String!
  55. filesize: Int!
  56. folder: Folder
  57. }
  58. type Folder implements Base {
  59. id: Int!
  60. createdAt: Date
  61. updatedAt: Date
  62. name: String!
  63. files: [File]
  64. }
  65. type Group implements Base {
  66. id: Int!
  67. createdAt: Date
  68. updatedAt: Date
  69. name: String!
  70. users: [User]
  71. rights: [Right]
  72. }
  73. type Right implements Base {
  74. id: Int!
  75. createdAt: Date
  76. updatedAt: Date
  77. path: String!
  78. role: RightRole!
  79. exact: Boolean!
  80. allow: Boolean!
  81. group: Group!
  82. }
  83. type SearchResult {
  84. path: String
  85. title: String
  86. tags: [String]
  87. }
  88. type Setting implements Base {
  89. id: Int!
  90. createdAt: Date
  91. updatedAt: Date
  92. key: String!
  93. config: String!
  94. }
  95. # Tags are attached to one or more documents
  96. type Tag implements Base {
  97. id: Int!
  98. createdAt: Date
  99. updatedAt: Date
  100. key: String!
  101. documents: [Document]
  102. }
  103. type Translation {
  104. key: String!
  105. value: String!
  106. }
  107. # A User
  108. type User implements Base {
  109. id: Int!
  110. createdAt: Date
  111. updatedAt: Date
  112. email: String!
  113. provider: String!
  114. providerId: String
  115. name: String
  116. role: UserRole!
  117. groups: [Group]
  118. }
  119. type OperationResult {
  120. succeeded: Boolean!
  121. message: String
  122. data: String
  123. }
  124. type LoginResult {
  125. succeeded: Boolean!
  126. message: String
  127. tfaRequired: Boolean
  128. tfaLoginToken: String
  129. }
  130. # Query (Read)
  131. type Query {
  132. comments(id: Int): [Comment]
  133. documents(id: Int, path: String): [Document]
  134. files(id: Int): [File]
  135. folders(id: Int, name: String): [Folder]
  136. groups(id: Int, name: String): [Group]
  137. rights(id: Int): [Right]
  138. search(q: String, tags: [String]): [SearchResult]
  139. settings(key: String): [Setting]
  140. tags(key: String): [Tag]
  141. translations(locale: String!, namespace: String!): [Translation]
  142. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  143. }
  144. # Mutations (Create, Update, Delete)
  145. type Mutation {
  146. addRightToGroup(
  147. groupId: Int!
  148. path: String!
  149. role: RightRole!
  150. exact: Boolean!
  151. allow: Boolean!
  152. ): Right
  153. assignTagToDocument(
  154. tagId: Int!
  155. documentId: Int!
  156. ): OperationResult
  157. assignUserToGroup(
  158. userId: Int!
  159. groupId: Int!
  160. ): OperationResult
  161. createComment(
  162. userId: Int!
  163. documentId: Int!
  164. content: String!
  165. ): Comment
  166. createDocument(
  167. path: String!
  168. title: String!
  169. subtitle: String
  170. ): Document
  171. createFolder(
  172. name: String!
  173. ): Folder
  174. createGroup(
  175. name: String!
  176. ): Group
  177. createTag(
  178. name: String!
  179. ): Tag
  180. createUser(
  181. email: String!
  182. name: String
  183. passwordRaw: String
  184. provider: String!
  185. providerId: String
  186. role: UserRole!
  187. ): User
  188. deleteComment(
  189. id: Int!
  190. ): OperationResult
  191. deleteDocument(
  192. id: Int!
  193. ): OperationResult
  194. deleteFile(
  195. id: Int!
  196. ): OperationResult
  197. deleteFolder(
  198. id: Int!
  199. ): OperationResult
  200. deleteGroup(
  201. id: Int!
  202. ): OperationResult
  203. deleteTag(
  204. id: Int!
  205. ): OperationResult
  206. deleteUser(
  207. id: Int!
  208. ): OperationResult
  209. login(
  210. username: String!
  211. password: String!
  212. provider: String!
  213. ): LoginResult
  214. loginTFA(
  215. loginToken: String!
  216. securityCode: String!
  217. ): OperationResult
  218. modifyComment(
  219. id: Int!
  220. content: String!
  221. ): Document
  222. modifyDocument(
  223. id: Int!
  224. title: String
  225. subtitle: String
  226. ): Document
  227. modifyUser(
  228. id: Int!
  229. email: String
  230. name: String
  231. provider: String
  232. providerId: String
  233. role: UserRole
  234. ): User
  235. modifyRight(
  236. id: Int!
  237. path: String
  238. role: RightRole
  239. exact: Boolean
  240. allow: Boolean
  241. ): Right
  242. moveDocument(
  243. id: Int!
  244. path: String!
  245. ): OperationResult
  246. moveFile(
  247. id: Int!
  248. folderId: Int!
  249. ): OperationResult
  250. renameFile(
  251. id: Int!
  252. name: String!
  253. ): OperationResult
  254. renameFolder(
  255. id: Int!
  256. name: String!
  257. ): OperationResult
  258. renameGroup(
  259. id: Int!
  260. name: String!
  261. ): OperationResult
  262. renameTag(
  263. id: Int!
  264. key: String!
  265. ): OperationResult
  266. removeTagFromDocument(
  267. tagId: Int!
  268. documentId: Int!
  269. ): OperationResult
  270. removeRightFromGroup(
  271. rightId: Int!
  272. ): OperationResult
  273. removeUserFromGroup(
  274. userId: Int!
  275. groupId: Int!
  276. ): OperationResult
  277. resetUserPassword(
  278. id: Int!
  279. ): OperationResult
  280. setConfigEntry(
  281. key: String!
  282. value: String!
  283. ): OperationResult
  284. setUserPassword(
  285. id: Int!
  286. passwordRaw: String!
  287. ): OperationResult
  288. uploadFile(
  289. category: FileType!
  290. filename: String!
  291. ): File
  292. }