graphql.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. export {
  102. USER_LOGIN, USER_LOGOUT, USER_SIGNUP, CURRENT_USER,
  103. TRAINING, TRAININGS, CREATE_TRAINING,
  104. TRAINING_TYPES, CREATE_TRAINING_TYPE
  105. }