training.graphql 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. # import * from '../../../backend/database/generated/prisma.graphql'
  2. # Only some basic data to be able to display the training
  3. query publishedTrainings(
  4. $where: TrainingWhereInput
  5. $orderBy: TrainingOrderByInput
  6. $skip: Int
  7. $first: Int
  8. ) {
  9. publishedTrainings(where: $where, orderBy: $orderBy, skip: $skip, first: $first) {
  10. id
  11. title
  12. type {
  13. id
  14. name
  15. description
  16. }
  17. trainingDate
  18. attendance
  19. registrations {
  20. id
  21. }
  22. }
  23. count: trainingsCount(where: $where) {
  24. aggregate {
  25. count
  26. }
  27. }
  28. }
  29. # The full data set, single item.
  30. query training($id: ID) {
  31. training(id: $id) {
  32. ...displayTraining
  33. }
  34. }
  35. # The full data set.
  36. query trainings(
  37. $where: TrainingWhereInput
  38. $orderBy: TrainingOrderByInput
  39. $skip: Int
  40. $after: String
  41. $before: String
  42. $first: Int
  43. $last: Int
  44. ) {
  45. count: trainingsCount(where: $where) {
  46. aggregate {
  47. count
  48. }
  49. }
  50. trainings(
  51. where: $where
  52. orderBy: $orderBy
  53. skip: $skip
  54. after: $after
  55. before: $before
  56. first: $first
  57. last: $last
  58. ) {
  59. ...displayTraining
  60. }
  61. }
  62. query trainingTypes {
  63. trainingTypes {
  64. id
  65. name
  66. description
  67. }
  68. }
  69. query formats {
  70. formats {
  71. id
  72. name
  73. description
  74. }
  75. }
  76. query blocks {
  77. blocks {
  78. ...blockWithoutBlocks
  79. blocks {
  80. ...blockInstanceWithoutBlock
  81. block {
  82. ...blockWithoutBlocks
  83. blocks {
  84. ...blockInstanceWithoutBlock
  85. block {
  86. ...blockWithoutBlocks
  87. }
  88. }
  89. }
  90. }
  91. }
  92. }
  93. query exercises {
  94. exercises {
  95. ...exerciseContent
  96. }
  97. }
  98. mutation createTraining(
  99. $title: String!
  100. $type: TrainingTypeCreateOneInput!
  101. $trainingDate: DateTime!
  102. $location: String!
  103. $attendance: Int!
  104. $published: Boolean!
  105. $blocks: BlockInstanceCreateManyWithoutParentTrainingInput
  106. ) {
  107. createTraining(
  108. title: $title
  109. type: $type
  110. trainingDate: $trainingDate
  111. location: $location
  112. attendance: $attendance
  113. published: $published
  114. blocks: $blocks
  115. ) {
  116. id
  117. }
  118. }
  119. mutation updateTraining($where: TrainingWhereUniqueInput!, $data: TrainingUpdateInput!) {
  120. updateTraining(where: $where, data: $data) {
  121. id
  122. }
  123. }
  124. mutation createTrainingType($name: String!, $description: String!) {
  125. createTrainingType(name: $name, description: $description) {
  126. id
  127. }
  128. }
  129. mutation createFormat($name: String!, $description: String!) {
  130. createFormat(name: $name, description: $description) {
  131. id
  132. }
  133. }
  134. mutation register($training: ID!) {
  135. register(training: $training)
  136. }
  137. mutation deregister($training: ID!) {
  138. deregister(training: $training)
  139. }
  140. mutation publish($training: ID!, $status: Boolean) {
  141. publish(training: $training, status: $status)
  142. }
  143. fragment exerciseContent on Exercise {
  144. id
  145. name
  146. description
  147. videos
  148. pictures
  149. targets
  150. baseExercise
  151. }
  152. fragment blockWithoutBlocks on Block {
  153. id
  154. title
  155. description
  156. videos
  157. pictures
  158. duration
  159. format {
  160. id
  161. name
  162. description
  163. }
  164. rest
  165. exercises {
  166. id
  167. exercise {
  168. ...exerciseContent
  169. }
  170. order
  171. repetitions
  172. variation
  173. }
  174. }
  175. fragment blockInstanceWithoutBlock on BlockInstance {
  176. id
  177. order
  178. rounds
  179. variation
  180. }
  181. fragment displayTraining on Training {
  182. id
  183. title
  184. type {
  185. id
  186. name
  187. description
  188. }
  189. createdAt
  190. trainingDate
  191. location
  192. attendance
  193. published
  194. blocks {
  195. ...blockInstanceWithoutBlock
  196. block {
  197. ...blockWithoutBlocks
  198. blocks {
  199. ...blockInstanceWithoutBlock
  200. block {
  201. ...blockWithoutBlocks
  202. blocks {
  203. ...blockInstanceWithoutBlock
  204. block {
  205. ...blockWithoutBlocks
  206. blocks {
  207. ...blockInstanceWithoutBlock
  208. block {
  209. ...blockWithoutBlocks
  210. blocks {
  211. id
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. registrations {
  222. id
  223. }
  224. }