Guest User

Untitled

a guest
Feb 25th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { gql } = require('apollo-server-express')
  2. module.exports = gql(`
  3. type Booking {
  4.     _id: ID!
  5.     event: Event!
  6.     user: User!
  7.     createdAt: String!
  8.     updatedAt: String!
  9. }
  10.  
  11. type Event {
  12.   _id: ID!
  13.   title: String!
  14.   description: String!
  15.   price: Float!
  16.   date: String!
  17.   creator: User!
  18. }
  19.  
  20. type User {
  21.   _id: ID!
  22.   email: String!
  23.   password: String
  24.   createdEvents: [Event!]
  25. }
  26.  
  27. type AuthData {
  28.   userId: ID!
  29.   token: String!
  30.   tokenExpiration: Int!
  31. }
  32.  
  33. input EventInput {
  34.   title: String!
  35.   description: String!
  36.   price: Float!
  37.   date: String!
  38. }
  39.  
  40. input UserInput {
  41.   email: String!
  42.   password: String!
  43. }
  44.  
  45. type RootQuery {
  46.     events: [Event!]!
  47.     bookings: [Booking!]!
  48.     login(email: String!, password: String!): AuthData!
  49. }
  50.  
  51. type RootMutation {
  52.     createEvent(eventInput: EventInput): Event
  53.     createUser(userInput: UserInput): User
  54.     bookEvent(eventId: ID!): Booking!
  55.     cancelBooking(bookingId: ID!): Event!
  56. }
  57.  
  58. schema {
  59.     query: RootQuery
  60.     mutation: RootMutation
  61. }
  62. `);
Add Comment
Please, Sign In to add comment