common.graphql 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. # ENUMS
  2. enum FileType {
  3. binary
  4. image
  5. }
  6. enum RightRole {
  7. read
  8. write
  9. manage
  10. }
  11. # INTERFACES
  12. interface Base {
  13. id: Int!
  14. createdAt: Date
  15. updatedAt: Date
  16. }
  17. # TYPES
  18. type KeyValuePair {
  19. key: String!
  20. value: String!
  21. }
  22. input KeyValuePairInput {
  23. key: String!
  24. value: String!
  25. }
  26. type DefaultResponse {
  27. responseResult: ResponseStatus
  28. }
  29. type ResponseStatus {
  30. succeeded: Boolean!
  31. errorCode: Int!
  32. slug: String!
  33. message: String
  34. }
  35. type Comment implements Base {
  36. id: Int!
  37. createdAt: Date
  38. updatedAt: Date
  39. content: String
  40. document: Document!
  41. author: User!
  42. }
  43. type Document implements Base {
  44. id: Int!
  45. createdAt: Date
  46. updatedAt: Date
  47. path: String!
  48. title: String!
  49. subtitle: String
  50. parentPath: String
  51. parentTitle: String
  52. isDirectory: Boolean!
  53. isEntry: Boolean!
  54. searchContent: String
  55. comments: [Comment]
  56. tags: [Tag]
  57. }
  58. type File implements Base {
  59. id: Int!
  60. createdAt: Date
  61. updatedAt: Date
  62. category: FileType!
  63. mime: String!
  64. extra: String
  65. filename: String!
  66. basename: String!
  67. filesize: Int!
  68. folder: Folder
  69. }
  70. type Folder implements Base {
  71. id: Int!
  72. createdAt: Date
  73. updatedAt: Date
  74. name: String!
  75. files: [File]
  76. }
  77. type Right implements Base {
  78. id: Int!
  79. createdAt: Date
  80. updatedAt: Date
  81. path: String!
  82. role: RightRole!
  83. exact: Boolean!
  84. allow: Boolean!
  85. group: Group!
  86. }
  87. type SearchResult {
  88. path: String
  89. title: String
  90. tags: [String]
  91. }
  92. type Setting implements Base {
  93. id: Int!
  94. createdAt: Date
  95. updatedAt: Date
  96. key: String!
  97. config: String!
  98. }
  99. # Tags are attached to one or more documents
  100. type Tag implements Base {
  101. id: Int!
  102. createdAt: Date
  103. updatedAt: Date
  104. key: String!
  105. documents: [Document]
  106. }
  107. type Translation {
  108. key: String!
  109. value: String!
  110. }
  111. type OperationResult {
  112. succeeded: Boolean!
  113. message: String
  114. data: 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. rights(id: Int): [Right]
  123. search(q: String, tags: [String]): [SearchResult]
  124. settings(key: String): [Setting]
  125. tags(key: String): [Tag]
  126. translations(locale: String!, namespace: String!): [Translation]
  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. createComment(
  142. userId: Int!
  143. documentId: Int!
  144. content: String!
  145. ): Comment
  146. createDocument(
  147. path: String!
  148. title: String!
  149. subtitle: String
  150. ): Document
  151. createFolder(
  152. name: String!
  153. ): Folder
  154. createTag(
  155. name: String!
  156. ): Tag
  157. deleteComment(
  158. id: Int!
  159. ): OperationResult
  160. deleteDocument(
  161. id: Int!
  162. ): OperationResult
  163. deleteFile(
  164. id: Int!
  165. ): OperationResult
  166. deleteFolder(
  167. id: Int!
  168. ): OperationResult
  169. deleteTag(
  170. id: Int!
  171. ): OperationResult
  172. modifyComment(
  173. id: Int!
  174. content: String!
  175. ): Document
  176. modifyDocument(
  177. id: Int!
  178. title: String
  179. subtitle: String
  180. ): Document
  181. modifyRight(
  182. id: Int!
  183. path: String
  184. role: RightRole
  185. exact: Boolean
  186. allow: Boolean
  187. ): Right
  188. moveDocument(
  189. id: Int!
  190. path: String!
  191. ): OperationResult
  192. moveFile(
  193. id: Int!
  194. folderId: Int!
  195. ): OperationResult
  196. renameFile(
  197. id: Int!
  198. name: String!
  199. ): OperationResult
  200. renameFolder(
  201. id: Int!
  202. name: String!
  203. ): OperationResult
  204. renameTag(
  205. id: Int!
  206. key: String!
  207. ): OperationResult
  208. removeTagFromDocument(
  209. tagId: Int!
  210. documentId: Int!
  211. ): OperationResult
  212. removeRightFromGroup(
  213. rightId: Int!
  214. ): OperationResult
  215. setConfigEntry(
  216. key: String!
  217. value: String!
  218. ): OperationResult
  219. uploadFile(
  220. category: FileType!
  221. filename: String!
  222. ): File
  223. }