common.graphql 5.1 KB

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