-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breakdown feed queries into smaller ones (#1630)
* Breakdown feed queries into smaller ones * Create dull-squids-tan.md * Products query * Products query * Products query * Products query * Products query --------- Co-authored-by: Paweł Chyła <[email protected]>
- Loading branch information
1 parent
6133deb
commit 945a27b
Showing
18 changed files
with
484 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"products-feed": patch | ||
--- | ||
|
||
Now, a single query for fetching variants was splitted into smaller ones to decrease the API overload. |
27 changes: 27 additions & 0 deletions
27
apps/products-feed/graphql/fragments/BasicProductDataFragment.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
fragment BasicProductData on ProductVariant { | ||
id | ||
name | ||
sku | ||
product { | ||
id | ||
} | ||
weight { | ||
unit | ||
value | ||
} | ||
pricing { | ||
priceUndiscounted { | ||
gross { | ||
currency | ||
amount | ||
} | ||
} | ||
price { | ||
gross { | ||
currency | ||
amount | ||
} | ||
} | ||
} | ||
quantityAvailable | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/products-feed/graphql/fragments/ProductAttributesFragment.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fragment ProductAttributes on ProductVariant { | ||
id | ||
attributes { | ||
attribute { | ||
id | ||
} | ||
values { | ||
value | ||
name | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
apps/products-feed/graphql/fragments/RelatedProductsFragment.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
fragment RelatedProducts on Product { | ||
id | ||
name | ||
slug | ||
description | ||
seoDescription | ||
productType { | ||
isShippingRequired | ||
} | ||
media { | ||
id | ||
alt | ||
url(size: $imageSize) | ||
type | ||
} | ||
variants { | ||
id | ||
media{ | ||
id | ||
alt | ||
url(size: $imageSize) | ||
type | ||
} | ||
} | ||
attributes{ | ||
attribute{ | ||
id | ||
} | ||
values{ | ||
value | ||
name | ||
} | ||
} | ||
thumbnail(size: $imageSize) { | ||
url | ||
} | ||
category { | ||
id | ||
name | ||
googleCategoryId: metafield(key: "google_category_id") | ||
} | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
...l/queries/FetchProductDataForFeed.graphql → ...hql/queries/FetchBasicProductData.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
apps/products-feed/graphql/queries/FetchProductAttributesData.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
query FetchProductAttributesData($first:Int!, $after: String, $channel: String!){ | ||
productVariants(first:$first, after: $after, channel: $channel){ | ||
pageInfo{ | ||
hasNextPage | ||
endCursor | ||
} | ||
edges{ | ||
node { | ||
...ProductAttributes | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
apps/products-feed/graphql/queries/FetchRelatedProductsData.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
query FetchRelatedProductsData($ids: [ID!], $imageSize: Int = 1024){ | ||
products(filter: { ids: $ids }, first: 100){ | ||
edges { | ||
node { | ||
...RelatedProducts | ||
} | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
apps/products-feed/src/modules/app-configuration/example-variant-data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
apps/products-feed/src/modules/google-feed/attribute-mapping.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.