common.graphql 4.6 KB

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