@infrab4a/connect 4.2.0 → 4.2.1-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 +8 -16
- package/index.esm.js +8 -16
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -4595,18 +4595,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4595
4595
|
const plainData = this.paramsToPlain({ products });
|
|
4596
4596
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4597
4597
|
return [];
|
|
4598
|
-
await this.
|
|
4599
|
-
where: {
|
|
4600
|
-
type: 'category_product_bool_exp',
|
|
4601
|
-
required: true,
|
|
4602
|
-
value: { category_id: { _eq: categoryId } },
|
|
4603
|
-
},
|
|
4604
|
-
});
|
|
4598
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4605
4599
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4606
4600
|
objects: {
|
|
4607
4601
|
type: '[category_product_insert_input!]',
|
|
4608
4602
|
required: true,
|
|
4609
|
-
value: plainData.products
|
|
4603
|
+
value: plainData.products
|
|
4604
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4605
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4610
4606
|
},
|
|
4611
4607
|
});
|
|
4612
4608
|
return plainData.products;
|
|
@@ -5561,19 +5557,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5561
5557
|
const plainData = this.paramsToPlain({ products });
|
|
5562
5558
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5563
5559
|
return [];
|
|
5564
|
-
await this.
|
|
5565
|
-
where: {
|
|
5566
|
-
type: 'category_product_bool_exp',
|
|
5567
|
-
required: true,
|
|
5568
|
-
value: { category_id: { _eq: categoryId } },
|
|
5569
|
-
},
|
|
5570
|
-
});
|
|
5560
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5571
5561
|
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5572
5562
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5573
5563
|
objects: {
|
|
5574
5564
|
type: '[category_product_insert_input!]',
|
|
5575
5565
|
required: true,
|
|
5576
|
-
value: plainData.products
|
|
5566
|
+
value: plainData.products
|
|
5567
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5568
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5577
5569
|
},
|
|
5578
5570
|
});
|
|
5579
5571
|
return plainData.products;
|
package/index.esm.js
CHANGED
|
@@ -4571,18 +4571,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4571
4571
|
const plainData = this.paramsToPlain({ products });
|
|
4572
4572
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4573
4573
|
return [];
|
|
4574
|
-
await this.
|
|
4575
|
-
where: {
|
|
4576
|
-
type: 'category_product_bool_exp',
|
|
4577
|
-
required: true,
|
|
4578
|
-
value: { category_id: { _eq: categoryId } },
|
|
4579
|
-
},
|
|
4580
|
-
});
|
|
4574
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4581
4575
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4582
4576
|
objects: {
|
|
4583
4577
|
type: '[category_product_insert_input!]',
|
|
4584
4578
|
required: true,
|
|
4585
|
-
value: plainData.products
|
|
4579
|
+
value: plainData.products
|
|
4580
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4581
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4586
4582
|
},
|
|
4587
4583
|
});
|
|
4588
4584
|
return plainData.products;
|
|
@@ -5537,19 +5533,15 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5537
5533
|
const plainData = this.paramsToPlain({ products });
|
|
5538
5534
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5539
5535
|
return [];
|
|
5540
|
-
await this.
|
|
5541
|
-
where: {
|
|
5542
|
-
type: 'category_product_bool_exp',
|
|
5543
|
-
required: true,
|
|
5544
|
-
value: { category_id: { _eq: categoryId } },
|
|
5545
|
-
},
|
|
5546
|
-
});
|
|
5536
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5547
5537
|
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5548
5538
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5549
5539
|
objects: {
|
|
5550
5540
|
type: '[category_product_insert_input!]',
|
|
5551
5541
|
required: true,
|
|
5552
|
-
value: plainData.products
|
|
5542
|
+
value: plainData.products
|
|
5543
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5544
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5553
5545
|
},
|
|
5554
5546
|
});
|
|
5555
5547
|
return plainData.products;
|