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.

361 lines
5.3 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. succeeded: Boolean!
  131. message: String
  132. data: String
  133. }
  134. type LoginResult {
  135. succeeded: Boolean!
  136. message: String
  137. tfaRequired: Boolean
  138. tfaLoginToken: String
  139. }
  140. # Query (Read)
  141. type Query {
  142. authentication(mode: String!): [AuthenticationProvider]
  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. login(
  221. username: String!
  222. password: String!
  223. provider: String!
  224. ): LoginResult
  225. loginTFA(
  226. loginToken: String!
  227. securityCode: String!
  228. ): OperationResult
  229. modifyComment(
  230. id: Int!
  231. content: String!
  232. ): Document
  233. modifyDocument(
  234. id: Int!
  235. title: String
  236. subtitle: String
  237. ): Document
  238. modifyUser(
  239. id: Int!
  240. email: String
  241. name: String
  242. provider: String
  243. providerId: String
  244. role: UserRole
  245. ): User
  246. modifyRight(
  247. id: Int!
  248. path: String
  249. role: RightRole
  250. exact: Boolean
  251. allow: Boolean
  252. ): Right
  253. moveDocument(
  254. id: Int!
  255. path: String!
  256. ): OperationResult
  257. moveFile(
  258. id: Int!
  259. folderId: Int!
  260. ): OperationResult
  261. renameFile(
  262. id: Int!
  263. name: String!
  264. ): OperationResult
  265. renameFolder(
  266. id: Int!
  267. name: String!
  268. ): OperationResult
  269. renameGroup(
  270. id: Int!
  271. name: String!
  272. ): OperationResult
  273. renameTag(
  274. id: Int!
  275. key: String!
  276. ): OperationResult
  277. removeTagFromDocument(
  278. tagId: Int!
  279. documentId: Int!
  280. ): OperationResult
  281. removeRightFromGroup(
  282. rightId: Int!
  283. ): OperationResult
  284. removeUserFromGroup(
  285. userId: Int!
  286. groupId: Int!
  287. ): OperationResult
  288. resetUserPassword(
  289. id: Int!
  290. ): OperationResult
  291. setConfigEntry(
  292. key: String!
  293. value: String!
  294. ): OperationResult
  295. setUserPassword(
  296. id: Int!
  297. passwordRaw: String!
  298. ): OperationResult
  299. uploadFile(
  300. category: FileType!
  301. filename: String!
  302. ): File
  303. }