Created
May 6, 2019 17:49
-
-
Save RafaelGSS/e90325af74b614be470650e5fa9a2ec8 to your computer and use it in GitHub Desktop.
Example GraphQL types pagination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Category implements IRecord { | |
id: ID! | |
products: [Product]! | |
category_name: String! | |
created_at: String! | |
updated_at: String | |
} | |
type CategoriesResource implements IResource { | |
pagination: Pagination! | |
records: [Category]! | |
} | |
type Product implements IRecord { | |
id: ID! | |
"""Get Brand of Product""" | |
brand: Brand! | |
"""Get Seller of Product""" | |
seller: Seller! | |
name: String! | |
unique_name: String! | |
display_description: String! | |
full_description: String! | |
stock: Int! | |
price: Float! | |
seller_custom_field: String! | |
is_active: Boolean! | |
"""Get Images of Product""" | |
images: [Image]! | |
"""Get Categories of Product""" | |
categories: [Category]! | |
"""Get current promotion active""" | |
promo: Promotion | |
"""Get all promotions for these product""" | |
promotions: [Promotion]! | |
"""Get Variations of product (size, color)""" | |
variations: [Variation]! | |
"""Get All attributes of product""" | |
attributes: [Attribute]! | |
"""Get Reviews of product""" | |
reviews: [Review]! | |
"""Get Tags of product (size, color)""" | |
tags: [Tag]! | |
} | |
type ProductsResource implements IResource { | |
pagination: Pagination! | |
records: [Product]! | |
} | |
interface IResource { | |
pagination: Pagination! | |
records: [IRecord]! | |
} | |
interface IRecord { | |
id: ID! | |
} | |
type Pagination { | |
per_page: Int! | |
current_page: Int! | |
total_pages: Int! | |
total_records: Int! | |
} | |
input PaginationInput { | |
page: Int | |
per_page: Int | |
} | |
type Query { | |
categories(pagination: PaginationInput) : CategoriesResource! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment