From 8b6eaf62ebb7febb8cd729fa40795cc1c094978d Mon Sep 17 00:00:00 2001 From: Will Lopez Date: Thu, 2 Apr 2020 13:42:50 -0700 Subject: [PATCH] refactor: add default value to shouldIncludeVariantMedia in GQL definition Signed-off-by: Will Lopez --- src/core-services/product/schemas/product.graphql | 4 +--- src/core-services/product/utils/getProductMedia.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core-services/product/schemas/product.graphql b/src/core-services/product/schemas/product.graphql index 7dafcd26ef0..b5a558753c5 100644 --- a/src/core-services/product/schemas/product.graphql +++ b/src/core-services/product/schemas/product.graphql @@ -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" @@ -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" diff --git a/src/core-services/product/utils/getProductMedia.js b/src/core-services/product/utils/getProductMedia.js index ee97c5f613c..be52cbdae82 100644 --- a/src/core-services/product/utils/getProductMedia.js +++ b/src/core-services/product/utils/getProductMedia.js @@ -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(