-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemaFile
69 lines (59 loc) · 1.57 KB
/
schemaFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#GraphQL schema
enum ProductSortingField {
PRODUCTNAME
PRODUCTPRICE
PRODUCTINVENTORY
PRODUCTID
}
enum ProductSortingOrder {
ASCENDING
DESCENDING
}
type Product {
productId: Int!
productName: String!
productPrice: Float!
productInventory: Int!
}
type ShoppingCart {
shoppingCartId: Int!
shoppingCartValue: Int!
shoppingCartItems: [OrderListing]!
shoppingCartKey: String!
}
type OrderListing {
orderListingId: Int!
product: Product!
productCount: Int!
shoppingCart: ShoppingCart!
}
type Query {
product(productId: Int!): Product
allProducts(
sortBy: ProductSortingField = PRODUCTPRICE,
sortOrder: ProductSortingOrder = ASCENDING,
inStockOnly: Boolean = false,
): [Product]!
shoppingCart(): ShoppingCart!
shoppingCartIsEmpty(): Boolean!
}
type Mutation {
createProduct(productName: String!, productPrice: Float!, productInventory: Int!):
productId, productName, productPrice, productInventory, errors
updateProduct(
productId: Int!,
productInventory: Int = None,
productName: String = None,
productPrice: Float = None):
productId, productName, productPrice, productInventory, errors
deleteProduct(productId: Int!):
productId, productName, productPrice, productInventory, errors
addProductToCart(productId: Int!, productCount: Int = 1):
shoppingCart!, orderListing, errors
removeProductFromCart(productId: Int!, productCount: Int = 1):
shoppingCart!, errors
clearShoppingCart():
shoppingCart!
checkOutShoppingCart():
totalSpend!, shoppingCart!
}