Skip to content

Instantly share code, notes, and snippets.

@smartinrub
Created July 15, 2019 16:27
Show Gist options
  • Save smartinrub/9e6069efb65747a6ef9e1993dfb1733c to your computer and use it in GitHub Desktop.
Save smartinrub/9e6069efb65747a6ef9e1993dfb1733c to your computer and use it in GitHub Desktop.
Schema Example
type Hotel {
id: ID!
# Hotel name
name: String!
# Hotel address
address: String!
# Date of the hotel registry creation
creationDate: String!
# List of rooms for a particular hotel
room: [Room]!
}
type Room {
id: ID!
# Room description
type: String!
# How many people can sleep in the room
occupants: Int!
}
type Payment {
id: ID!
# Payment method name
name: String!
}
# The Root Query for the application
type Query {
# Retrieves all hotels
findAllHotels: [Hotel]
# Retrieves a Hotel given an ID (eg: '1, 4, 12')
findHotelById(id: ID): Hotel
# Number of Hotel available
countHotels: Int
# Finds all payment methods
findAllPayments: [Payment]
}
# The Root Mutation for the application
type Mutation {
# Creates new hotel
newHotel(name: String!, address: String!): Hotel
# Creates new payment method
newPayment(name: String!): Payment
}
type Subscription {
getNewHotel: Hotel!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment