summaryrefslogtreecommitdiffstats
path: root/frontend/queries/index.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-02-02 15:23:20 -0500
committerWes Bos <wesbos@gmail.com>2018-02-02 15:23:20 -0500
commiteabff7cd396d1f37ceb929e666f082ce57f07919 (patch)
tree6fbd487688ee9e53bada734288994c35b732150e /frontend/queries/index.js
parentcd0b07b3adb36fb5ec098f9e511ab45d774fee7b (diff)
updateS
Diffstat (limited to 'frontend/queries/index.js')
-rw-r--r--frontend/queries/index.js71
1 files changed, 45 insertions, 26 deletions
diff --git a/frontend/queries/index.js b/frontend/queries/index.js
index 8b7897f..fb7445e 100644
--- a/frontend/queries/index.js
+++ b/frontend/queries/index.js
@@ -1,23 +1,26 @@
-import gql from 'graphql-tag';
-import { itemDetails } from './fragments';
+import gql from "graphql-tag";
+import { itemDetails } from "./fragments";
export const CREATE_ITEM_MUTATION = gql`
${itemDetails}
- mutation CreateLinkMutation($description: String!, $title: String!, $imageId: ID, $price: Int!) {
- createItem(
- description: $description,
- title: $title,
- imageId: $imageId
- price: $price
- ) {
+ mutation createItem($description: String!, $title: String!, $price: Int!) {
+ createItem(description: $description, title: $title, price: $price) {
...itemDetails
}
}
`;
export const CREATE_USER_MUTATION = gql`
- mutation CreateUserMutation($email: String!, $name: String!, $idToken: String!) {
- createUser(email: $email, name: $name, authProvider: { auth0: { idToken: $idToken } }) {
+ mutation CreateUserMutation(
+ $email: String!
+ $name: String!
+ $idToken: String!
+ ) {
+ createUser(
+ email: $email
+ name: $name
+ authProvider: { auth0: { idToken: $idToken } }
+ ) {
id
email
name
@@ -52,11 +55,19 @@ export const CREATE_ORDER_MUTATION = gql`
export const ALL_ITEMS_QUERY = gql`
# Import the Fragment
${itemDetails}
- query AllLinksQuery($skip: Int = 0, $first: Int = 3) {
- _allItemsMeta {
- count
+ query AllItemsQuery($skip: Int = 0, $first: Int = 3) {
+ itemsConnection(orderBy: createdAt_DESC, first: $first, skip: $skip) {
+ pageInfo {
+ hasNextPage
+ hasPreviousPage
+ startCursor
+ endCursor
+ }
+ aggregate {
+ count
+ }
}
- allItems(orderBy: createdAt_DESC, first: $first, skip: $skip) {
+ items(orderBy: createdAt_DESC, first: $first, skip: $skip) {
...itemDetails
}
}
@@ -74,12 +85,14 @@ export const SINGLE_ITEM_QUERY = gql`
export const SEARCH_ITEMS_QUERY = gql`
${itemDetails}
query SearchItems($searchTerm: String!) {
- allItems(filter:{
- OR:[
- { title_contains: $searchTerm },
- { description_contains: $searchTerm },
- ]
- }) {
+ allItems(
+ filter: {
+ OR: [
+ { title_contains: $searchTerm }
+ { description_contains: $searchTerm }
+ ]
+ }
+ ) {
...itemDetails
}
}
@@ -97,12 +110,18 @@ export const DELETE_ITEM_MUTATION = gql`
export const UPDATE_LINK_MUTATION = gql`
${itemDetails}
- mutation UpdateItem($id: ID!, $title: String!, $description: String!, $price: Int!, $fullPrice: Int!) {
+ mutation UpdateItem(
+ $id: ID!
+ $title: String!
+ $description: String!
+ $price: Int!
+ $fullPrice: Int!
+ ) {
updateItem(
- id: $id,
- description: $description,
- title: $title,
- price: $price,
+ id: $id
+ description: $description
+ title: $title
+ price: $price
fullPrice: $fullPrice
) {
...itemDetails