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.

181 lines
6.9 KiB

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