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.

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