tree.graphql 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # ===============================================
  2. # TREE
  3. # ===============================================
  4. extend type Query {
  5. """
  6. Browse the tree.
  7. Must provide either `parentId` or a combination of `parentPath` and `locale`.
  8. """
  9. tree(
  10. siteId: UUID!
  11. parentId: UUID
  12. parentPath: String
  13. locale: String
  14. types: [TreeItemType]
  15. limit: Int
  16. offset: Int
  17. orderBy: TreeOrderBy
  18. orderByDirection: OrderByDirection
  19. """
  20. How many levels of children to include. Defaults to 1.
  21. """
  22. depth: Int
  23. """
  24. Include all parent folders up to root
  25. """
  26. includeAncestors: Boolean
  27. """
  28. Include all folders at root level
  29. """
  30. includeRootFolders: Boolean
  31. ): [TreeItem]
  32. folderById(
  33. id: UUID!
  34. ): TreeItemFolder
  35. folderByPath(
  36. siteId: UUID!
  37. locale: String!
  38. path: String!
  39. ): TreeItemFolder
  40. }
  41. extend type Mutation {
  42. createFolder(
  43. siteId: UUID!
  44. locale: String!
  45. parentId: UUID
  46. parentPath: String
  47. pathName: String!
  48. title: String!
  49. ): DefaultResponse
  50. deleteFolder(
  51. folderId: UUID!
  52. ): DefaultResponse
  53. duplicateFolder(
  54. folderId: UUID!
  55. targetParentId: UUID
  56. targetPathName: String!
  57. targetTitle: String!
  58. ): DefaultResponse
  59. moveFolder(
  60. folderId: UUID!
  61. targetParentId: UUID
  62. ): DefaultResponse
  63. renameFolder(
  64. folderId: UUID!
  65. pathName: String!
  66. title: String!
  67. ): DefaultResponse
  68. }
  69. # -----------------------------------------------
  70. # TYPES
  71. # -----------------------------------------------
  72. enum TreeItemType {
  73. asset
  74. folder
  75. page
  76. }
  77. enum TreeOrderBy {
  78. createdAt
  79. fileName
  80. title
  81. updatedAt
  82. }
  83. interface TreeItem {
  84. id: UUID
  85. folderPath: String
  86. fileName: String
  87. title: String
  88. }
  89. type TreeItemFolder implements TreeItem {
  90. id: UUID
  91. childrenCount: Int
  92. depth: Int
  93. fileName: String
  94. folderPath: String
  95. title: String
  96. isAncestor: Boolean
  97. }
  98. type TreeItemPage implements TreeItem {
  99. id: UUID
  100. createdAt: Date
  101. depth: Int
  102. fileName: String
  103. folderPath: String
  104. editor: String
  105. pageType: String
  106. title: String
  107. updatedAt: Date
  108. }
  109. type TreeItemAsset implements TreeItem {
  110. id: UUID
  111. createdAt: Date
  112. depth: Int
  113. fileName: String
  114. # In Bytes
  115. fileSize: Int
  116. fileExt: String
  117. mimeType: String
  118. folderPath: String
  119. title: String
  120. updatedAt: Date
  121. }