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.

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