You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

319 lines
4.6 KiB

  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. # A User
  101. type User implements Base {
  102. id: Int!
  103. createdAt: Date
  104. updatedAt: Date
  105. email: String!
  106. provider: String!
  107. providerId: String
  108. name: String
  109. role: UserRole!
  110. groups: [Group]
  111. }
  112. type OperationResult {
  113. succeded: Boolean!
  114. message: 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. groups(id: Int, name: String): [Group]
  123. rights(id: Int): [Right]
  124. settings(key: String): [Setting]
  125. tags(key: String): [Tag]
  126. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  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. assignUserToGroup(
  142. userId: Int!
  143. groupId: Int!
  144. ): OperationResult
  145. createComment(
  146. userId: Int!
  147. documentId: Int!
  148. content: String!
  149. ): Comment
  150. createDocument(
  151. path: String!
  152. title: String!
  153. subtitle: String
  154. ): Document
  155. createFolder(
  156. name: String!
  157. ): Folder
  158. createGroup(
  159. name: String!
  160. ): Group
  161. createTag(
  162. name: String!
  163. ): Tag
  164. createUser(
  165. email: String!
  166. name: String
  167. passwordRaw: String
  168. provider: String!
  169. providerId: String
  170. role: UserRole!
  171. ): User
  172. deleteComment(
  173. id: Int!
  174. ): OperationResult
  175. deleteDocument(
  176. id: Int!
  177. ): OperationResult
  178. deleteFile(
  179. id: Int!
  180. ): OperationResult
  181. deleteFolder(
  182. id: Int!
  183. ): OperationResult
  184. deleteGroup(
  185. id: Int!
  186. ): OperationResult
  187. deleteTag(
  188. id: Int!
  189. ): OperationResult
  190. deleteUser(
  191. id: Int!
  192. ): OperationResult
  193. modifyComment(
  194. id: Int!
  195. content: String!
  196. ): Document
  197. modifyDocument(
  198. id: Int!
  199. title: String
  200. subtitle: String
  201. ): Document
  202. modifyUser(
  203. id: Int!
  204. email: String
  205. name: String
  206. provider: String
  207. providerId: String
  208. role: UserRole
  209. ): User
  210. modifyRight(
  211. id: Int!
  212. path: String
  213. role: RightRole
  214. exact: Boolean
  215. allow: Boolean
  216. ): Right
  217. moveDocument(
  218. id: Int!
  219. path: String!
  220. ): OperationResult
  221. moveFile(
  222. id: Int!
  223. folderId: Int!
  224. ): OperationResult
  225. renameFile(
  226. id: Int!
  227. name: String!
  228. ): OperationResult
  229. renameFolder(
  230. id: Int!
  231. name: String!
  232. ): OperationResult
  233. renameGroup(
  234. id: Int!
  235. name: String!
  236. ): OperationResult
  237. renameTag(
  238. id: Int!
  239. key: String!
  240. ): OperationResult
  241. removeTagFromDocument(
  242. tagId: Int!
  243. documentId: Int!
  244. ): OperationResult
  245. removeRightFromGroup(
  246. rightId: Int!
  247. ): OperationResult
  248. removeUserFromGroup(
  249. userId: Int!
  250. groupId: 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. }