graphql.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import gql from 'graphql-tag'
  2. const USER_LOGIN = gql`
  3. mutation USER_LOGIN($email: String!, $password: String!) {
  4. login(email: $email, password: $password) {
  5. id
  6. email
  7. name
  8. }
  9. }
  10. `
  11. const USER_LOGOUT = gql`
  12. mutation USER_LOGOUT {
  13. logout
  14. }
  15. `
  16. const USER_SIGNUP = gql`
  17. mutation USER_SIGNUP($email: String!, $password: String!, $name: String!) {
  18. signup(email: $email, password: $password, name: $name) {
  19. id
  20. email
  21. name
  22. }
  23. }
  24. `
  25. const CURRENT_USER = gql`
  26. query {
  27. me {
  28. id
  29. email
  30. name
  31. }
  32. }
  33. `
  34. const TRAINING = gql`
  35. query TRAINING($id: ID!){
  36. training(id: $id) {
  37. id
  38. title
  39. type {
  40. name
  41. description
  42. }
  43. createdAt
  44. trainingDate
  45. location
  46. registration {
  47. id
  48. }
  49. attendance
  50. }
  51. }
  52. `
  53. const TRAININGS = gql`
  54. query TRAININGS {
  55. trainings {
  56. id
  57. title
  58. type {
  59. name
  60. description
  61. }
  62. content {
  63. title
  64. }
  65. trainingDate
  66. location
  67. registration {
  68. name
  69. }
  70. attendance
  71. ratings {
  72. value
  73. }
  74. published
  75. }
  76. }
  77. `
  78. const TRAINING_TYPES = gql`
  79. query TRAINING_TYPES {
  80. trainingTypes {
  81. id
  82. name
  83. description
  84. }
  85. }
  86. `
  87. const CREATE_TRAINING = gql`
  88. mutation CREATE_TRAINING($title: String!, $trainingDate: DateTime!) {
  89. createTraining (title: $title, trainingDate: $trainingDate) {
  90. id
  91. }
  92. }
  93. `
  94. const CREATE_TRAINING_TYPE = gql`
  95. mutation CREATE_TRAINING_TYPE($name: String!, $description: String!) {
  96. createTrainingType (name: $name, description: $description) {
  97. id
  98. }
  99. }
  100. `
  101. const BLOCKS = gql`
  102. query BLOCKS {
  103. blocks {
  104. sequence
  105. title
  106. duration
  107. variation
  108. format {
  109. name
  110. description
  111. }
  112. tracks {
  113. title
  114. artist
  115. duration
  116. link
  117. }
  118. exercise {
  119. name
  120. description
  121. video
  122. targets
  123. baseExercise {
  124. name
  125. }
  126. }
  127. description
  128. }
  129. }
  130. `
  131. const CREATE_BLOCK = gql`
  132. mutation CREATE_BLOCK($sequence: Int!, $title: String!, $duration: Int!, $variation: String, $format: ID, $tracks: [ID]!, $exercises: [ID]!, $description: String!) {
  133. createBlock(sequence: $sequence, title: $title, duration: $duration, variation: $variation, format: $format, tracks: $tracks, exercises: $exercises, description: $description) {
  134. id
  135. }
  136. }
  137. `
  138. export {
  139. USER_LOGIN, USER_LOGOUT, USER_SIGNUP, CURRENT_USER,
  140. TRAINING, TRAININGS, CREATE_TRAINING,
  141. TRAINING_TYPES, CREATE_TRAINING_TYPE,
  142. BLOCKS, CREATE_BLOCK
  143. }