@infrab4a/connect 4.2.3 → 4.2.4-beta.0

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
@@ -4972,11 +4972,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4972
4972
  const plainData = this.paramsToPlain({ categories });
4973
4973
  if (!plainData.categories || plainData.categories.length <= 0)
4974
4974
  return [];
4975
+ const product = await this.get({ id: productId.toString() });
4975
4976
  await this.mutation('delete_category_product', ['affected_rows'], {
4976
4977
  where: {
4977
4978
  type: 'category_product_bool_exp',
4978
4979
  required: true,
4979
- value: { product_id: { _eq: productId } },
4980
+ value: {
4981
+ product_id: { _eq: productId },
4982
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
4983
+ },
4980
4984
  },
4981
4985
  });
4982
4986
  await this.mutation('insert_category_product', ['affected_rows'], {
@@ -5437,7 +5441,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5437
5441
  type: 'category_product_bool_exp',
5438
5442
  required: true,
5439
5443
  value: {
5440
- category_id: categoryId,
5444
+ category_id: { _eq: categoryId },
5441
5445
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5442
5446
  },
5443
5447
  },
package/index.esm.js CHANGED
@@ -4966,11 +4966,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4966
4966
  const plainData = this.paramsToPlain({ categories });
4967
4967
  if (!plainData.categories || plainData.categories.length <= 0)
4968
4968
  return [];
4969
+ const product = await this.get({ id: productId.toString() });
4969
4970
  await this.mutation('delete_category_product', ['affected_rows'], {
4970
4971
  where: {
4971
4972
  type: 'category_product_bool_exp',
4972
4973
  required: true,
4973
- value: { product_id: { _eq: productId } },
4974
+ value: {
4975
+ product_id: { _eq: productId },
4976
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
4977
+ },
4974
4978
  },
4975
4979
  });
4976
4980
  await this.mutation('insert_category_product', ['affected_rows'], {
@@ -5431,7 +5435,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5431
5435
  type: 'category_product_bool_exp',
5432
5436
  required: true,
5433
5437
  value: {
5434
- category_id: categoryId,
5438
+ category_id: { _eq: categoryId },
5435
5439
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5436
5440
  },
5437
5441
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.2.3",
3
+ "version": "4.2.4-beta.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },