Skip to content

Commit

Permalink
refactor: add default value to shouldIncludeVariantMedia in GQL
Browse files Browse the repository at this point in the history
definition

Signed-off-by: Will Lopez <[email protected]>
  • Loading branch information
willopez committed Apr 2, 2020
1 parent b478c4b commit 8b6eaf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/core-services/product/schemas/product.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Product {
"All media for a product"
media(
"Determines whether variant media should be included in the product or not"
shouldIncludeVariantMedia: Boolean
shouldIncludeVariantMedia: Boolean = true
): [ImageInfo]

"The product description to use for page `description` meta element in HTML"
Expand Down Expand Up @@ -609,8 +609,6 @@ extend type Query {
"Shop ID"
shopId: ID!

"Should variant media be included in the top level product?"
shouldIncludeVariantMedia: Boolean
): Product

"Query for a list of Products"
Expand Down
2 changes: 1 addition & 1 deletion src/core-services/product/utils/getProductMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default async function getProductMedia(product, { shouldIncludeVariantMed

let includeVariantMedia = {};
if (!shouldIncludeVariantMedia) {
includeVariantMedia = { "metadata.variantId": { $eq: null } };
includeVariantMedia = { "metadata.variantId": null };
}

const mediaArray = await Media.find(
Expand Down

0 comments on commit 8b6eaf6

Please sign in to comment.