Skip to content

Commit

Permalink
refactor: Update GraphQL fragments in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyzen committed Aug 19, 2024
1 parent 966b83f commit d9dcbaf
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 28 deletions.
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/addToCart.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation addToCart($input: AddToCartInput!) {
addToCart(input: $input) {
cart {
...CartFragment
...Cart
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/applyCoupon.gql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mutation applyCoupon($code: String!) {
discountAmount
}
cart {
...CartFragment
...Cart
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/changeShippingMethod.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation ChangeShippingMethod($shippingMethods: [String] = "") {
updateShippingMethod(input: { shippingMethods: $shippingMethods }) {
cart {
...CartFragment
...Cart
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/emptyCart.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation EmptyCart {
emptyCart(input: { clearPersistentCart: true }) {
cart {
...CartFragment
...Cart
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/fragments/CartFragment.gql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fragment CartFragment on Cart {
fragment Cart on Cart {
total
rawTotal: total(format: RAW)
subtotal
Expand Down
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/fragments/CustomerFragment.gql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fragment CustomerFragment on Customer {
fragment Customer on Customer {
lastName
email
firstName
Expand Down
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/fragments/OrderFragment.gql
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ fragment OrderFragment on Order {
}
}
customer {
...CustomerFragment
...Customer
}
}
44 changes: 26 additions & 18 deletions woonuxt_base/app/queries/getCart.gql
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
query getCart {
cart {
...CartFragment
...Cart
}
customer {
...CustomerFragment
...Customer
}
viewer {
lastName
email
databaseId
id
firstName
username
nicename
wooSessionToken
avatar {
url
}
...Viewer
}
paymentGateways {
nodes {
title
id
description
}
...PaymentGateways
}
}

fragment Viewer on User {
lastName
email
databaseId
id
firstName
username
nicename
wooSessionToken
avatar {
url
}
}

fragment PaymentGateways on RootQueryToPaymentGatewayConnection {
nodes {
title
id
description
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/registerCustomer.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation registerCustomer($input: RegisterCustomerInput!) {
registerCustomer(input: $input) {
customer {
...CustomerFragment
...Customer
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/removeCoupon.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation removeCoupons($codes: [String]!) {
removeCoupons(input: { codes: $codes }) {
cart {
...CartFragment
...Cart
}
}
}
2 changes: 1 addition & 1 deletion woonuxt_base/app/queries/updateCartQuantity.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutation UpDateCartQuantity($key: ID!, $quantity: Int!) {
updateItemQuantities(input: { items: { key: $key, quantity: $quantity } }) {
cart {
...CartFragment
...Cart
}
}
}

0 comments on commit d9dcbaf

Please sign in to comment.