@unchainedshop/core-products 4.8.19 → 4.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,6 +23,7 @@ const PRODUCT_EVENTS = [
|
|
|
23
23
|
const InternalProductStatus = {
|
|
24
24
|
DRAFT: null,
|
|
25
25
|
};
|
|
26
|
+
const isDraftStatus = (status) => status === ProductStatus.DRAFT || status === InternalProductStatus.DRAFT;
|
|
26
27
|
export const buildFindSelector = ({ slugs, tags, includeDrafts = false, includeDeleted = false, productIds, productSelector, queryString, skus, bundleItemProductIds, proxyAssignmentProductIds, }) => {
|
|
27
28
|
const selector = productSelector ? { ...productSelector } : {};
|
|
28
29
|
if (productIds && !selector._id) {
|
|
@@ -94,7 +95,7 @@ export const configureProductsModule = async (moduleInput) => {
|
|
|
94
95
|
return deletedResult.deletedCount;
|
|
95
96
|
};
|
|
96
97
|
const publishProduct = async (product) => {
|
|
97
|
-
if (product.status
|
|
98
|
+
if (isDraftStatus(product.status)) {
|
|
98
99
|
await Products.updateOne(generateDbFilterById(product._id), {
|
|
99
100
|
$set: {
|
|
100
101
|
status: ProductStatus.ACTIVE,
|
|
@@ -187,7 +188,7 @@ export const configureProductsModule = async (moduleInput) => {
|
|
|
187
188
|
return product.status === ProductStatus.ACTIVE;
|
|
188
189
|
},
|
|
189
190
|
isDraft: (product) => {
|
|
190
|
-
return product.status
|
|
191
|
+
return isDraftStatus(product.status);
|
|
191
192
|
},
|
|
192
193
|
normalizedStatus: (product) => {
|
|
193
194
|
return product.status === null ? ProductStatus.DRAFT : product.status;
|
package/package.json
CHANGED