@infrab4a/connect 4.3.0-beta.5 → 4.3.0-beta.6

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.
package/index.cjs.js CHANGED
@@ -5138,11 +5138,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5138
5138
  const plainData = this.paramsToPlain({ categories });
5139
5139
  if (!plainData.categories || plainData.categories.length <= 0)
5140
5140
  return [];
5141
+ const product = await this.get({ id: productId.toString() });
5141
5142
  await this.mutation('delete_category_product', ['affected_rows'], {
5142
5143
  where: {
5143
5144
  type: 'category_product_bool_exp',
5144
5145
  required: true,
5145
- value: { product_id: { _eq: productId } },
5146
+ value: {
5147
+ product_id: { _eq: productId },
5148
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5149
+ },
5146
5150
  },
5147
5151
  });
5148
5152
  await this.mutation('insert_category_product', ['affected_rows'], {
@@ -5603,7 +5607,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5603
5607
  type: 'category_product_bool_exp',
5604
5608
  required: true,
5605
5609
  value: {
5606
- category_id: categoryId,
5610
+ category_id: { _eq: categoryId },
5607
5611
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5608
5612
  },
5609
5613
  },
package/index.esm.js CHANGED
@@ -5114,11 +5114,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5114
5114
  const plainData = this.paramsToPlain({ categories });
5115
5115
  if (!plainData.categories || plainData.categories.length <= 0)
5116
5116
  return [];
5117
+ const product = await this.get({ id: productId.toString() });
5117
5118
  await this.mutation('delete_category_product', ['affected_rows'], {
5118
5119
  where: {
5119
5120
  type: 'category_product_bool_exp',
5120
5121
  required: true,
5121
- value: { product_id: { _eq: productId } },
5122
+ value: {
5123
+ product_id: { _eq: productId },
5124
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5125
+ },
5122
5126
  },
5123
5127
  });
5124
5128
  await this.mutation('insert_category_product', ['affected_rows'], {
@@ -5579,7 +5583,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5579
5583
  type: 'category_product_bool_exp',
5580
5584
  required: true,
5581
5585
  value: {
5582
- category_id: categoryId,
5586
+ category_id: { _eq: categoryId },
5583
5587
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5584
5588
  },
5585
5589
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.3.0-beta.5",
3
+ "version": "4.3.0-beta.6",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },