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.

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