1. Design and develop resolver for queries, process schema and presenters
2. Choose between pagination options and implement chosen one
3. Create ResultHandler and ErrorHandler (who said it would be easy)
4. Create endpoint
5. Send a query
Input types:
wishlists (first: 10, after: "cursor") {
edges {
cursor,
node {
id,
name,
items {
id,
type
}
}
},
totalCount,
pageInfo {
startCursor,
endCursor,
hasNextPage,
hasPreviousPage
}
}
wishlists (first: $first, offset: $offset) {
edges {
id,
name,
items {
id,
type
}
},
pageInfo {
first,
offset,
total,
hasNextPage,
hasPreviousPage
}
}
CruiseType {
reservationNumber,
checkInTime,
departureTime,
departureCity,
departurePort,
cruiseShip,
cruiseLine,
arrivalTime,
checkOutTime,
arrivalCity,
arrivalPort,
stops,
bookingClass,
additionalInformation
}
RailwayType {
ticketNumber,
departureTime,
departureCity,
trainNumber,
trainPlace,
arrivalTime,
arrivalCity,
bookingClass
}
BookingType {
id
}
BookingType {
… on CruiseType {
reservationNumber,
checkInTime,
departureTime,
departureCity,
departurePort,
cruiseShip,
cruiseLine,
arrivalTime,
checkOutTime,
arrivalCity,
arrivalPort,
stops,
bookingClass,
additionalInformation
},
… on RailwayTripType {
ticketNumber,
departureTime,
departureCity,
trainNumber,
trainPlace,
arrivalTime,
arrivalCity,
bookingClass
}
}
'bookingType' =>
$this->getBookingUnionType('BookingTypeInterfaceType')
'args' => [ 'file' => new UploadType()]
mutation(
$file: Upload
) {
uploadYourFileHere(
file: $file
) {
File {
path,
name
}
}
Don't query unreliable data! You don't need it.
Wishlist {
id,
name
}
Wishlist {
id,
name,
items {
id,
type,
name,
category,
price,
currency
}
}
No recursions! You can do better than this!
Author {
name,
books {
title,
authors {
name,
books
}
}
}
wishlists (first: $first, offset: $offset) { #fetches wishlists (N queries)
edges {
id,
name,
items { #fetches items for each wishlist (M queries per wishlist)
id,
type
}
},
pageInfo {
first,
offset,
total,
hasNextPage,
hasPreviousPage
}
} # therefore M*N queries
NoSQL
Cache