@infrab4a/connect 4.0.0-beta.29 → 4.0.0-beta.30

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.
@@ -1687,7 +1687,12 @@ class ProductsIndex {
1687
1687
  },
1688
1688
  },
1689
1689
  });
1690
- search.hits = search.hits.filter((e) => e._source.name !== '');
1690
+ search.hits = search.hits
1691
+ .filter((e) => e._source.name !== '')
1692
+ .map((hit) => {
1693
+ RoundProductPricesHelper.roundProductPrices(hit._source);
1694
+ return hit;
1695
+ });
1691
1696
  return search;
1692
1697
  }
1693
1698
  async save(product) {
@@ -2246,6 +2251,12 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
2246
2251
  getCategoryByShop(shop) {
2247
2252
  return;
2248
2253
  }
2254
+ getChildren(parentId) {
2255
+ return;
2256
+ }
2257
+ isChild(id, parentId) {
2258
+ return;
2259
+ }
2249
2260
  }
2250
2261
 
2251
2262
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
@@ -3672,6 +3683,20 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
3672
3683
  }
3673
3684
  return [];
3674
3685
  }
3686
+ async getChildren(parentId) {
3687
+ const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id'], {
3688
+ args: {
3689
+ type: 'category_tree_args',
3690
+ value: { parentid: parentId },
3691
+ required: true,
3692
+ },
3693
+ });
3694
+ return category_tree.map((category) => Category.toInstance(category));
3695
+ }
3696
+ async isChild(id, parentId) {
3697
+ const categoryTree = await this.getChildren(parentId);
3698
+ return categoryTree.some((c) => c.id == id.toString());
3699
+ }
3675
3700
  }
3676
3701
 
3677
3702
  class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {