forked from JawherKl/graphql-nodejs-ecom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-ecom.graphql
131 lines (115 loc) · 1.97 KB
/
api-ecom.graphql
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
mutation {
register(name: "ay Doe", email: "[email protected]", password: "aypass", role: "admin") {
user {
id
name
email
role
}
token
}
}
mutation Register($name: String!, $registerEmail2: String!, $registerPassword2: String!, $role: String!) {
register(name: $name, email: $registerEmail2, password: $registerPassword2, role: $role) {
user {
id
name
email
role
}
token
}
}
mutation Login($email: String!, $password: String!) {
login(email: $email, password: $password) {
user {
id
name
email
}
token
}
}
mutation {
createProduct(name: "Tablet", description: "lenovo tablet 2021", price: 219.99) {
id
name
price
}
}
query GetProducts {
getProducts {
id
name
price
}
}
query {
getProductById(id: "676156119043a8975426aaed") {
name
}
}
mutation {
updateProduct(id: "676156119043a8975426aaed", name: "Laptop PC", description: "Lenovo laptop omen 16", price: 2119.99) {
id
name
price
}
}
mutation DeleteProduct($deleteProductId: ID!) {
deleteProduct(id: $deleteProductId) {
name
}
}
mutation {
createOrder(
products: [
{ productId: "676156089043a8975426aaeb", quantity: 2 },
{ productId: "676156119043a8975426aaed", quantity: 1 }
],
totalAmount: 7339.98
) {
id
totalAmount
status
products {
product {
id
name
}
quantity
}
}
}
mutation {
updateOrderStatus(id: "6761576c9043a8975426aafc", status: "Shipped") {
id
status
}
}
query {
getOrderById(id: "6761576c9043a8975426aafc") {
id
totalAmount
status
products {
product {
id
name
price
}
quantity
}
}
}
mutation {
deleteOrder(id: "67603c1a51c9b63ef70f4ef5")
}
mutation {
createReview(productId: "676156089043a8975426aaeb", rating: 5, comment: "Great product!") {
id
rating
comment
createdAt
}
}