diff options
| author | Wes Bos <wesbos@gmail.com> | 2017-08-25 09:33:53 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2017-08-25 09:33:53 -0400 |
| commit | 7af74ff8988961c988f03c95961b70c2918521ae (patch) | |
| tree | d73cd0dd94751b76595b7febcae4162811c2040b /queries/index.js | |
| parent | 416c2cbae0e69b724876d232bf813eefd7550174 (diff) | |
yay
Diffstat (limited to 'queries/index.js')
| -rw-r--r-- | queries/index.js | 69 |
1 files changed, 62 insertions, 7 deletions
diff --git a/queries/index.js b/queries/index.js index aca6a42..e3dbd38 100644 --- a/queries/index.js +++ b/queries/index.js @@ -3,24 +3,48 @@ import { itemDetails } from './fragments'; export const CREATE_LINK_MUTATION = gql` ${itemDetails} - mutation CreateLinkMutation($description: String!, $title: String!, $imageId: ID) { + mutation CreateLinkMutation($description: String!, $title: String!, $imageId: ID, $price: Int!) { createItem( description: $description, title: $title, imageId: $imageId + price: $price ) { ...itemDetails } } ` -export const CREATE_ORDER_MUTATION = gql` - mutation CreateOrderMutation($token: String!) { - createOrder(token: $token) { +export const CREATE_USER_MUTATION = gql` + mutation CreateUserMutation($email: String!, $name: String!, $idToken: String!) { + createUser( + email: $email, + name: $name, + authProvider: { auth0: { idToken: $idToken } } + ) { id, - token, - charge, - amount, + email, + name + } + } +` + +export const CREATE_ORDER_MUTATION = gql` + mutation CreateOrderMutation($token: String!, $userId: ID!, $itemId: ID!) { + createOrder(token: $token, userId: $userId, itemId: $itemId) { + id + token + charge + amount + item { + id + title + description + } + user { + id + email + } } } `; @@ -70,3 +94,34 @@ export const UPDATE_LINK_MUTATION = gql` } } ` + +export const CURRENT_USER_QUERY = gql` + query userQuery { + user { + id + name + email + } + } +`; + +export const USER_ORDERS_QUERY = gql` + query { + user { # grab the current user + id + orders { # and a all their orders + id + amount + charge + item { # populate the details about the item they bought with the image, description and title + image { + id, + secret + } + description + title + } + } + } + } +`; |
