types.graphql 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. createdOn: Date
  22. updatedOn: Date
  23. }
  24. # TYPES
  25. type Comment implements Base {
  26. id: Int!
  27. createdOn: Date
  28. updatedOn: Date
  29. content: String
  30. document: Document!
  31. author: User!
  32. }
  33. type Document implements Base {
  34. id: Int!
  35. createdOn: Date
  36. updatedOn: 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. createdOn: Date
  50. updatedOn: 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. createdOn: Date
  62. updatedOn: Date
  63. name: String!
  64. }
  65. type Group implements Base {
  66. id: Int!
  67. createdOn: Date
  68. updatedOn: Date
  69. name: String!
  70. users: [User]
  71. rights: [Right]
  72. }
  73. type Right implements Base {
  74. id: Int!
  75. createdOn: Date
  76. updatedOn: Date
  77. path: String!
  78. role: RightRole!
  79. exact: Boolean!
  80. allow: Boolean!
  81. }
  82. type Setting implements Base {
  83. id: Int!
  84. createdOn: Date
  85. updatedOn: Date
  86. key: String!
  87. config: String!
  88. }
  89. # Tags are attached to one or more documents
  90. type Tag implements Base {
  91. id: Int!
  92. createdOn: Date
  93. updatedOn: Date
  94. key: String!
  95. }
  96. # A User
  97. type User implements Base {
  98. id: Int!
  99. createdOn: Date
  100. updatedOn: Date
  101. email: String!
  102. provider: String!
  103. providerId: String
  104. name: String
  105. role: UserRole!
  106. groups: [Group]
  107. }
  108. # Query (Read)
  109. type Query {
  110. comments(id: Int): [Comment]
  111. documents(id: Int, path: String): [Document]
  112. files(id: Int): [File]
  113. folders(id: Int, name: String): [Folder]
  114. groups(id: Int, name: String): [Group]
  115. rights(id: Int): [Right]
  116. settings(key: String): [Setting]
  117. tags(key: String): [Tag]
  118. users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
  119. }
  120. # Mutations (Create, Update, Delete)
  121. type Mutation {
  122. assignUserToGroup(
  123. userId: Int!
  124. groupId: Int!
  125. ): Boolean
  126. createGroup(
  127. name: String!
  128. ): Group
  129. createUser(
  130. email: String!
  131. name: String
  132. provider: String!
  133. providerId: String
  134. role: UserRole!
  135. ): User
  136. deleteGroup(
  137. id: Int!
  138. ): Boolean
  139. deleteUser(
  140. id: Int!
  141. ): Boolean
  142. removeUserFromGroup(
  143. userId: Int!
  144. groupId: Int!
  145. ): Boolean
  146. }