training.graphql 4.7 KB

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