|
| 1 | +mutation { |
| 2 | + register( name: "ay Doe", email: "[email protected]", password: "aypass", role: "admin") { |
| 3 | + user { |
| 4 | + id |
| 5 | + name |
| 6 | + email |
| 7 | + role |
| 8 | + } |
| 9 | + token |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +mutation Register($name: String!, $registerEmail2: String!, $registerPassword2: String!, $role: String!) { |
| 16 | + register(name: $name, email: $registerEmail2, password: $registerPassword2, role: $role) { |
| 17 | + user { |
| 18 | + id |
| 19 | + name |
| 20 | + email |
| 21 | + role |
| 22 | + } |
| 23 | + token |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +mutation Login($email: String!, $password: String!) { |
| 28 | + login(email: $email, password: $password) { |
| 29 | + user { |
| 30 | + id |
| 31 | + name |
| 32 | + email |
| 33 | + } |
| 34 | + token |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +mutation { |
| 39 | + createProduct(name: "Tablet", description: "lenovo tablet 2021", price: 219.99) { |
| 40 | + id |
| 41 | + name |
| 42 | + price |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +query GetProducts { |
| 47 | + getProducts { |
| 48 | + id |
| 49 | + name |
| 50 | + price |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +query { |
| 55 | + getProductById(id: "676156119043a8975426aaed") { |
| 56 | + name |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +mutation { |
| 61 | + updateProduct(id: "676156119043a8975426aaed", name: "Laptop PC", description: "Lenovo laptop omen 16", price: 2119.99) { |
| 62 | + id |
| 63 | + name |
| 64 | + price |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +mutation DeleteProduct($deleteProductId: ID!) { |
| 69 | + deleteProduct(id: $deleteProductId) { |
| 70 | + name |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +mutation { |
| 77 | + createOrder( |
| 78 | + products: [ |
| 79 | + { productId: "676156089043a8975426aaeb", quantity: 2 }, |
| 80 | + { productId: "676156119043a8975426aaed", quantity: 1 } |
| 81 | + ], |
| 82 | + totalAmount: 7339.98 |
| 83 | + ) { |
| 84 | + id |
| 85 | + totalAmount |
| 86 | + status |
| 87 | + products { |
| 88 | + product { |
| 89 | + id |
| 90 | + name |
| 91 | + } |
| 92 | + quantity |
| 93 | + } |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +mutation { |
| 98 | + updateOrderStatus(id: "6761576c9043a8975426aafc", status: "Shipped") { |
| 99 | + id |
| 100 | + status |
| 101 | + } |
| 102 | +} |
| 103 | + |
| 104 | +query { |
| 105 | + getOrderById(id: "6761576c9043a8975426aafc") { |
| 106 | + id |
| 107 | + totalAmount |
| 108 | + status |
| 109 | + products { |
| 110 | + product { |
| 111 | + id |
| 112 | + name |
| 113 | + price |
| 114 | + } |
| 115 | + quantity |
| 116 | + } |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +mutation { |
| 121 | + deleteOrder(id: "67603c1a51c9b63ef70f4ef5") |
| 122 | +} |
| 123 | + |
| 124 | +mutation { |
| 125 | + createReview(productId: "676156089043a8975426aaeb", rating: 5, comment: "Great product!") { |
| 126 | + id |
| 127 | + rating |
| 128 | + comment |
| 129 | + createdAt |
| 130 | + } |
| 131 | +} |
0 commit comments