GraphQL API and utilities for the rpdata project
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.

186 lines
7.1 KiB

  1. package graph2
  2. import (
  3. "git.aiterp.net/rpdata/api/graph2/graphcore"
  4. "git.aiterp.net/rpdata/api/models"
  5. )
  6. func complexity() (cr graphcore.ComplexityRoot) {
  7. subListComplexity := 25
  8. bigSublistComplexity := 75
  9. hugeSublistComplexity := 100
  10. findComplexity := 100
  11. listComplexity := 200
  12. mutationComplexity := 100
  13. cr.Query.Character = func(childComplexity int, id *string, nick *string) int {
  14. return childComplexity + findComplexity
  15. }
  16. cr.Query.Characters = func(childComplexity int, filter *models.CharacterFilter) int {
  17. return childComplexity + listComplexity
  18. }
  19. cr.Query.Channel = func(childComplexity int, name string) int {
  20. return childComplexity + findComplexity
  21. }
  22. cr.Query.Channels = func(childComplexity int, filter *models.ChannelFilter) int {
  23. return childComplexity + listComplexity
  24. }
  25. cr.Query.Post = func(childComplexity int, id string) int {
  26. return childComplexity + findComplexity
  27. }
  28. cr.Query.Posts = func(childComplexity int, filter *models.PostFilter) int {
  29. return childComplexity + listComplexity
  30. }
  31. cr.Query.UnknownNicks = func(childComplexity int, filter *graphcore.UnknownNicksFilter) int {
  32. return childComplexity + listComplexity
  33. }
  34. cr.Query.Log = func(childComplexity int, id string) int {
  35. return childComplexity + findComplexity
  36. }
  37. cr.Query.Logs = func(childComplexity int, filter *models.LogFilter) int {
  38. if filter != nil && ((filter.Open != nil && *filter.Open == true) || (filter.Limit <= 10)) {
  39. return childComplexity + findComplexity
  40. }
  41. return childComplexity + listComplexity
  42. }
  43. cr.Query.Chapter = func(childComplexity int, id string) int {
  44. return childComplexity + findComplexity
  45. }
  46. cr.Query.Comment = func(childComplexity int, id string) int {
  47. return childComplexity + findComplexity
  48. }
  49. cr.Query.Tags = func(childComplexity int, filter *graphcore.TagFilter) int {
  50. return childComplexity + listComplexity
  51. }
  52. cr.Query.Story = func(childComplexity int, id string) int {
  53. return childComplexity + findComplexity
  54. }
  55. cr.Query.Stories = func(childComplexity int, filter *models.StoryFilter) int {
  56. if filter != nil && filter.Limit <= 10 {
  57. return childComplexity + findComplexity
  58. }
  59. return childComplexity + listComplexity
  60. }
  61. cr.Query.File = func(childComplexity int, id string) int {
  62. return childComplexity + findComplexity
  63. }
  64. cr.Query.Files = func(childComplexity int, filter *models.FileFilter) int {
  65. return childComplexity + listComplexity
  66. }
  67. cr.Query.Changes = func(childComplexity int, filter *models.ChangeFilter) int {
  68. return childComplexity + listComplexity
  69. }
  70. cr.Query.Token = func(childComplexity int) int {
  71. return childComplexity + findComplexity
  72. }
  73. cr.Mutation.AddStory = func(childComplexity int, input graphcore.StoryAddInput) int {
  74. return childComplexity + mutationComplexity
  75. }
  76. cr.Mutation.AddStoryTag = func(childComplexity int, input graphcore.StoryTagAddInput) int {
  77. return childComplexity + mutationComplexity
  78. }
  79. cr.Mutation.RemoveStoryTag = func(childComplexity int, input graphcore.StoryTagRemoveInput) int {
  80. return childComplexity + mutationComplexity
  81. }
  82. cr.Mutation.EditStory = func(childComplexity int, input graphcore.StoryEditInput) int {
  83. return childComplexity + mutationComplexity
  84. }
  85. cr.Mutation.RemoveStory = func(childComplexity int, input graphcore.StoryRemoveInput) int {
  86. return childComplexity + mutationComplexity
  87. }
  88. cr.Mutation.AddChapter = func(childComplexity int, input graphcore.ChapterAddInput) int {
  89. return childComplexity + mutationComplexity
  90. }
  91. cr.Mutation.EditChapter = func(childComplexity int, input graphcore.ChapterEditInput) int {
  92. return childComplexity + mutationComplexity
  93. }
  94. cr.Mutation.MoveChapter = func(childComplexity int, input graphcore.ChapterMoveInput) int {
  95. return childComplexity + mutationComplexity
  96. }
  97. cr.Mutation.RemoveChapter = func(childComplexity int, input graphcore.ChapterRemoveInput) int {
  98. return childComplexity + mutationComplexity
  99. }
  100. cr.Mutation.AddComment = func(childComplexity int, input graphcore.CommentAddInput) int {
  101. return childComplexity + mutationComplexity
  102. }
  103. cr.Mutation.EditComment = func(childComplexity int, input graphcore.CommentEditInput) int {
  104. return childComplexity + mutationComplexity
  105. }
  106. cr.Mutation.RemoveComment = func(childComplexity int, input graphcore.CommentRemoveInput) int {
  107. return childComplexity + mutationComplexity
  108. }
  109. cr.Mutation.AddLog = func(childComplexity int, input graphcore.LogAddInput) int {
  110. return childComplexity + mutationComplexity
  111. }
  112. cr.Mutation.ImportLog = func(childComplexity int, input graphcore.LogImportInput) int {
  113. return childComplexity + mutationComplexity
  114. }
  115. cr.Mutation.EditLog = func(childComplexity int, input graphcore.LogEditInput) int {
  116. return childComplexity + mutationComplexity
  117. }
  118. cr.Mutation.RemoveLog = func(childComplexity int, input graphcore.LogRemoveInput) int {
  119. return childComplexity + mutationComplexity
  120. }
  121. cr.Mutation.AddPost = func(childComplexity int, input graphcore.PostAddInput) int {
  122. return childComplexity + mutationComplexity
  123. }
  124. cr.Mutation.EditPost = func(childComplexity int, input graphcore.PostEditInput) int {
  125. return childComplexity + mutationComplexity
  126. }
  127. cr.Mutation.MovePost = func(childComplexity int, input graphcore.PostMoveInput) int {
  128. return childComplexity + mutationComplexity
  129. }
  130. cr.Mutation.RemovePost = func(childComplexity int, input graphcore.PostRemoveInput) int {
  131. return childComplexity + mutationComplexity
  132. }
  133. cr.Mutation.AddCharacter = func(childComplexity int, input graphcore.CharacterAddInput) int {
  134. return childComplexity + mutationComplexity
  135. }
  136. cr.Mutation.AddCharacterNick = func(childComplexity int, input graphcore.CharacterNickInput) int {
  137. return childComplexity + mutationComplexity
  138. }
  139. cr.Mutation.RemoveCharacterNick = func(childComplexity int, input graphcore.CharacterNickInput) int {
  140. return childComplexity + mutationComplexity
  141. }
  142. cr.Mutation.EditCharacter = func(childComplexity int, input graphcore.CharacterEditInput) int {
  143. return childComplexity + mutationComplexity
  144. }
  145. cr.Mutation.RemoveCharacter = func(childComplexity int, input graphcore.CharacterRemoveInput) int {
  146. return childComplexity + mutationComplexity
  147. }
  148. cr.Mutation.AddChannel = func(childComplexity int, input graphcore.ChannelAddInput) int {
  149. return childComplexity + mutationComplexity
  150. }
  151. cr.Mutation.EditChannel = func(childComplexity int, input graphcore.ChannelEditInput) int {
  152. return childComplexity + mutationComplexity
  153. }
  154. cr.Log.Characters = func(childComplexity int) int {
  155. return childComplexity + subListComplexity
  156. }
  157. cr.Log.Posts = func(childComplexity int, kinds []string) int {
  158. return childComplexity + hugeSublistComplexity
  159. }
  160. cr.Log.NextLogs = func(childComplexity int) int {
  161. return childComplexity + (subListComplexity / 2)
  162. }
  163. cr.Log.PrevLogs = func(childComplexity int) int {
  164. return childComplexity + (subListComplexity / 2)
  165. }
  166. cr.Story.Chapters = func(childComplexity int) int {
  167. return childComplexity + bigSublistComplexity
  168. }
  169. cr.Story.Tags = func(childComplexity int) int {
  170. return childComplexity + subListComplexity
  171. }
  172. cr.Chapter.Comments = func(childComplexity int, limit *int) int {
  173. return childComplexity + subListComplexity
  174. }
  175. return
  176. }