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

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
@@ -4482,6 +4482,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4482
4482
  fields: ['id', 'name', 'reference', 'slug'],
4483
4483
  },
4484
4484
  },
4485
+ 'theme',
4486
+ { bannerUrl: { columnName: 'banner_url' } },
4485
4487
  ],
4486
4488
  });
4487
4489
  this.productRepository = productRepository;
@@ -5138,18 +5140,24 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5138
5140
  const plainData = this.paramsToPlain({ categories });
5139
5141
  if (!plainData.categories || plainData.categories.length <= 0)
5140
5142
  return [];
5143
+ const product = await this.get({ id: productId.toString() });
5141
5144
  await this.mutation('delete_category_product', ['affected_rows'], {
5142
5145
  where: {
5143
5146
  type: 'category_product_bool_exp',
5144
5147
  required: true,
5145
- value: { product_id: { _eq: productId } },
5148
+ value: {
5149
+ product_id: { _eq: productId },
5150
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5151
+ },
5146
5152
  },
5147
5153
  });
5148
5154
  await this.mutation('insert_category_product', ['affected_rows'], {
5149
5155
  objects: {
5150
5156
  type: '[category_product_insert_input!]',
5151
5157
  required: true,
5152
- value: plainData.categories.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5158
+ value: plainData.categories
5159
+ .filter((categoryId) => !product.categories.includes(categoryId))
5160
+ .map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5153
5161
  },
5154
5162
  });
5155
5163
  return plainData.categories;
@@ -5520,6 +5528,8 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5520
5528
  { personId: { columnName: 'person_id' } },
5521
5529
  { personName: { columnName: 'person_name' } },
5522
5530
  { personPhoto: { columnName: 'person_photo' } },
5531
+ 'theme',
5532
+ { bannerUrl: { columnName: 'banner_url' } },
5523
5533
  ],
5524
5534
  });
5525
5535
  this.categoryFilterRepository = categoryFilterRepository;
@@ -5603,7 +5613,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5603
5613
  type: 'category_product_bool_exp',
5604
5614
  required: true,
5605
5615
  value: {
5606
- category_id: categoryId,
5616
+ category_id: { _eq: categoryId },
5607
5617
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5608
5618
  },
5609
5619
  },
package/index.esm.js CHANGED
@@ -4458,6 +4458,8 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4458
4458
  fields: ['id', 'name', 'reference', 'slug'],
4459
4459
  },
4460
4460
  },
4461
+ 'theme',
4462
+ { bannerUrl: { columnName: 'banner_url' } },
4461
4463
  ],
4462
4464
  });
4463
4465
  this.productRepository = productRepository;
@@ -5114,18 +5116,24 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5114
5116
  const plainData = this.paramsToPlain({ categories });
5115
5117
  if (!plainData.categories || plainData.categories.length <= 0)
5116
5118
  return [];
5119
+ const product = await this.get({ id: productId.toString() });
5117
5120
  await this.mutation('delete_category_product', ['affected_rows'], {
5118
5121
  where: {
5119
5122
  type: 'category_product_bool_exp',
5120
5123
  required: true,
5121
- value: { product_id: { _eq: productId } },
5124
+ value: {
5125
+ product_id: { _eq: productId },
5126
+ category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
5127
+ },
5122
5128
  },
5123
5129
  });
5124
5130
  await this.mutation('insert_category_product', ['affected_rows'], {
5125
5131
  objects: {
5126
5132
  type: '[category_product_insert_input!]',
5127
5133
  required: true,
5128
- value: plainData.categories.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5134
+ value: plainData.categories
5135
+ .filter((categoryId) => !product.categories.includes(categoryId))
5136
+ .map((categoryId) => ({ category_id: categoryId, product_id: productId })),
5129
5137
  },
5130
5138
  });
5131
5139
  return plainData.categories;
@@ -5496,6 +5504,8 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5496
5504
  { personId: { columnName: 'person_id' } },
5497
5505
  { personName: { columnName: 'person_name' } },
5498
5506
  { personPhoto: { columnName: 'person_photo' } },
5507
+ 'theme',
5508
+ { bannerUrl: { columnName: 'banner_url' } },
5499
5509
  ],
5500
5510
  });
5501
5511
  this.categoryFilterRepository = categoryFilterRepository;
@@ -5579,7 +5589,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5579
5589
  type: 'category_product_bool_exp',
5580
5590
  required: true,
5581
5591
  value: {
5582
- category_id: categoryId,
5592
+ category_id: { _eq: categoryId },
5583
5593
  product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5584
5594
  },
5585
5595
  },
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.7",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -24,6 +24,8 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
24
24
  isWishlist?: boolean;
25
25
  reference?: string;
26
26
  parentId?: number;
27
+ theme?: string;
28
+ bannerUrl?: string;
27
29
  parent?: CategoryBase;
28
30
  filters?: Filter[];
29
31
  static get identifiersFields(): GenericIdentifier[];