types.graphql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. tags: [Tag]
  46. }
  47. type File implements Base {
  48. id: Int!
  49. createdAt: Date
  50. updatedAt: Date
  51. category: FileType!
  52. mime: String!
  53. extra: String
  54. filename: String!
  55. basename: String!
  56. filesize: Int!
  57. folder: Folder
  58. }
  59. type Folder implements Base {
  60. id: Int!
  61. createdAt: Date
  62. updatedAt: Date
  63. name: String!
  64. files: [File]
  65. }
  66. type Group implements Base {
  67. id: Int!
  68. createdAt: Date
  69. updatedAt: Date
  70. name: String!
  71. users: [User]
  72. rights: [Right]
  73. }
  74. type Right implements Base {
  75. id: Int!
  76. createdAt: Date
  77. updatedAt: Date
  78. path: String!
  79. role: RightRole!
  80. exact: Boolean!
  81. allow: Boolean!
  82. }
  83. type Setting implements Base {
  84. id: Int!
  85. createdAt: Date
  86. updatedAt: Date
  87. key: String!
  88. config: String!
  89. }
  90. # Tags are attached to one or more documents
  91. type Tag implements Base {
  92. id: Int!
  93. createdAt: Date
  94. updatedAt: Date
  95. key: String!,
  96. documents: [Document]
  97. }
  98. # A User
  99. type User implements Base {
  100. id: Int!
  101. createdAt: Date
  102. updatedAt: Date
  103. email: String!
  104. provider: String!
  105. providerId: String
  106. name: String
  107. role: UserRole!
  108. groups: [Group]
  109. }
  110. # Query (Read)
  111. type Query {
  112. comments(id: Int): [Comment]
  113. documents(id: Int, path: String): [Document]
  114. files(id: Int): [File]
  115. folders(id: Int, name: String): [Folder]
  116. groups(id: Int, name: String): [Group]
  117. rights(id: Int): [Right]
  118. settings(key: String): [Setting]
  119. tags(key: String): [Tag]
  120. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  121. }
  122. # Mutations (Create, Update, Delete)
  123. type Mutation {
  124. assignTagToDocument(
  125. tagId: Int!
  126. documentId: Int!
  127. ): Boolean
  128. assignUserToGroup(
  129. userId: Int!
  130. groupId: Int!
  131. ): Boolean
  132. createFolder(
  133. name: String!
  134. ): Folder
  135. createGroup(
  136. name: String!
  137. ): Group
  138. createTag(
  139. name: String!
  140. ): Tag
  141. createUser(
  142. email: String!
  143. name: String
  144. provider: String!
  145. providerId: String
  146. role: UserRole!
  147. ): User
  148. deleteFolder(
  149. id: Int!
  150. ): Boolean
  151. deleteGroup(
  152. id: Int!
  153. ): Boolean
  154. deleteTag(
  155. id: Int!
  156. ): Boolean
  157. deleteUser(
  158. id: Int!
  159. ): Boolean
  160. removeTagFromDocument(
  161. tagId: Int!
  162. documentId: Int!
  163. ): Boolean
  164. removeUserFromGroup(
  165. userId: Int!
  166. groupId: Int!
  167. ): Boolean
  168. }