diff --git a/packages/medusa-plugin-brightpearl/CHANGELOG.md b/packages/medusa-plugin-brightpearl/CHANGELOG.md index 3908b4ef7c..b4f7f55f97 100644 --- a/packages/medusa-plugin-brightpearl/CHANGELOG.md +++ b/packages/medusa-plugin-brightpearl/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.35](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.34...medusa-plugin-brightpearl@1.1.35) (2021-10-26) + +### Bug Fixes + +- add missing discount rule to bp orders ([#680](https://github.com/medusajs/medusa/issues/680)) ([d8422fc](https://github.com/medusajs/medusa/commit/d8422fc759f8a55e6290d4f54f3ea38df3118c8b)) + ## [1.1.34](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.33...medusa-plugin-brightpearl@1.1.34) (2021-10-18) **Note:** Version bump only for package medusa-plugin-brightpearl diff --git a/packages/medusa-plugin-brightpearl/package.json b/packages/medusa-plugin-brightpearl/package.json index 570a0254bf..981c67e098 100644 --- a/packages/medusa-plugin-brightpearl/package.json +++ b/packages/medusa-plugin-brightpearl/package.json @@ -1,6 +1,6 @@ { "name": "medusa-plugin-brightpearl", - "version": "1.1.34", + "version": "1.1.35", "description": "Brightpearl plugin for Medusa Commerce", "main": "index.js", "repository": { diff --git a/packages/medusa-plugin-brightpearl/src/subscribers/order.js b/packages/medusa-plugin-brightpearl/src/subscribers/order.js index 61caed781e..6af07f9ac3 100644 --- a/packages/medusa-plugin-brightpearl/src/subscribers/order.js +++ b/packages/medusa-plugin-brightpearl/src/subscribers/order.js @@ -77,6 +77,7 @@ class OrderSubscriber { "order.region", "order.swaps", "order.discounts", + "order.discounts.rule", "return_order", "return_order.items", "return_order.shipping_method", @@ -109,6 +110,7 @@ class OrderSubscriber { "order.region", "order.claims", "order.discounts", + "order.discounts.rule", "claim_items", "return_order", "return_order.items", diff --git a/packages/medusa-plugin-contentful/CHANGELOG.md b/packages/medusa-plugin-contentful/CHANGELOG.md index bd35f4a14b..ec9bec5285 100644 --- a/packages/medusa-plugin-contentful/CHANGELOG.md +++ b/packages/medusa-plugin-contentful/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.31...medusa-plugin-contentful@1.1.32) (2021-10-25) + +### Bug Fixes + +- make contentful data sync ([548f6c7](https://github.com/medusajs/medusa/commit/548f6c7138d9a08b6c2113ebdda27f13dee848ac)) + ## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.30...medusa-plugin-contentful@1.1.31) (2021-10-18) **Note:** Version bump only for package medusa-plugin-contentful diff --git a/packages/medusa-plugin-contentful/package.json b/packages/medusa-plugin-contentful/package.json index 484437537f..03e2a8cdfa 100644 --- a/packages/medusa-plugin-contentful/package.json +++ b/packages/medusa-plugin-contentful/package.json @@ -1,6 +1,6 @@ { "name": "medusa-plugin-contentful", - "version": "1.1.31", + "version": "1.1.32", "description": "Contentful plugin for Medusa Commerce", "main": "index.js", "repository": { diff --git a/packages/medusa-plugin-contentful/src/services/contentful.js b/packages/medusa-plugin-contentful/src/services/contentful.js index 210abfd082..edb59143a9 100644 --- a/packages/medusa-plugin-contentful/src/services/contentful.js +++ b/packages/medusa-plugin-contentful/src/services/contentful.js @@ -742,21 +742,35 @@ class ContentfulService extends BaseService { const environment = await this.getContentfulEnvironment_() const productEntry = await environment.getEntry(productId) - const product = await this.productService_.retrieve(productId) + const product = await this.productService_.retrieve(productId, { + select: [ + "id", + "handle", + "title", + "subtitle", + "description", + "thumbnail", + ], + }) const update = {} const title = - productEntry.fields[this.getCustomField("title", "product")]["en-US"] + productEntry.fields[this.getCustomField("title", "product")]?.["en-US"] const subtitle = - productEntry.fields[this.getCustomField("subtitle", "product")]["en-US"] - - const description = - productEntry.fields[this.getCustomField("description", "product")][ + productEntry.fields[this.getCustomField("subtitle", "product")]?.[ "en-US" ] + const description = + productEntry.fields[this.getCustomField("description", "product")]?.[ + "en-US" + ] + + const handle = + productEntry.fields[this.getCustomField("handle", "product")]?.["en-US"] + if (product.title !== title) { update.title = title } @@ -769,6 +783,10 @@ class ContentfulService extends BaseService { update.description = description } + if (product.handle !== handle) { + update.handle = handle + } + // Get the thumbnail, if present if (productEntry.fields.thumbnail) { const thumb = await environment.getAsset( @@ -776,7 +794,7 @@ class ContentfulService extends BaseService { ) if (thumb.fields.file["en-US"].url) { - if (!product.thumbnail.includes(thumb.fields.file["en-US"].url)) { + if (!product.thumbnail?.includes(thumb.fields.file["en-US"].url)) { update.thumbnail = thumb.fields.file["en-US"].url } } @@ -834,7 +852,6 @@ class ContentfulService extends BaseService { output.push(transformed) } - console.log(output) if (!isArray) { return output[0] } diff --git a/packages/medusa/CHANGELOG.md b/packages/medusa/CHANGELOG.md index 1a37cb6dd7..e550dbba5a 100644 --- a/packages/medusa/CHANGELOG.md +++ b/packages/medusa/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.49](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.48...@medusajs/medusa@1.1.49) (2021-10-26) + +### Bug Fixes + +- allow empty string to search product route ([52c47ab](https://github.com/medusajs/medusa/commit/52c47abd407704d02caf7a6bfb3c4777717828b7)) + +## [1.1.48](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.47...@medusajs/medusa@1.1.48) (2021-10-25) + +### Bug Fixes + +- make contentful data sync ([548f6c7](https://github.com/medusajs/medusa/commit/548f6c7138d9a08b6c2113ebdda27f13dee848ac)) + ## [1.1.47](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.46...@medusajs/medusa@1.1.47) (2021-10-23) ### Bug Fixes diff --git a/packages/medusa/package.json b/packages/medusa/package.json index 799acbcfc0..9642a6ca51 100644 --- a/packages/medusa/package.json +++ b/packages/medusa/package.json @@ -1,6 +1,6 @@ { "name": "@medusajs/medusa", - "version": "1.1.47", + "version": "1.1.49", "description": "E-commerce for JAMstack", "main": "dist/index.js", "bin": { diff --git a/packages/medusa/src/api/routes/store/products/search.js b/packages/medusa/src/api/routes/store/products/search.js index e9a4303001..c21c95243f 100644 --- a/packages/medusa/src/api/routes/store/products/search.js +++ b/packages/medusa/src/api/routes/store/products/search.js @@ -4,7 +4,9 @@ import ProductService from "../../../../services/product" export default async (req, res) => { const schema = Validator.object() .keys({ - q: Validator.string().required(), + q: Validator.string() + .required() + .allow(""), offset: Validator.number().optional(), limit: Validator.number().optional(), filter: Validator.any(), diff --git a/packages/medusa/src/repositories/product.ts b/packages/medusa/src/repositories/product.ts index dae618da4e..e6e5df9724 100644 --- a/packages/medusa/src/repositories/product.ts +++ b/packages/medusa/src/repositories/product.ts @@ -55,6 +55,10 @@ export class ProductRepository extends Repository { return [] } + if (relations.length === 0) { + return this.findByIds(entitiesIds, idsOrOptionsWithoutRelations) + } + const groupedRelations: { [toplevel: string]: string[] } = {} for (const rel of relations) { const [topLevel] = rel.split(".")