graphql.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. trainingDate
  59. }
  60. }
  61. `
  62. const CREATE_TRAINING = gql`
  63. mutation CREATE_TRAINING($title: String!, $trainingDate: DateTime!) {
  64. createTraining (title: $title, trainingDate: $trainingDate) {
  65. id
  66. }
  67. }
  68. `
  69. export {
  70. USER_LOGIN, USER_LOGOUT, USER_SIGNUP, CURRENT_USER,
  71. TRAINING, TRAININGS, CREATE_TRAINING
  72. }