@infrab4a/connect-angular 4.3.7-beta.6 → 4.3.7-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.
@@ -2085,6 +2085,39 @@ class HomeShopService {
2085
2085
  data,
2086
2086
  })).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
2087
2087
  }
2088
+ getShopMenu() {
2089
+ return from(this.categoryRepository.find({
2090
+ filters: {
2091
+ reference: { operator: Where.ISNOTNULL },
2092
+ parentId: { operator: Where.ISNULL },
2093
+ shop: { operator: Where.EQUALS, value: this.defaultShop },
2094
+ },
2095
+ fields: ['id', 'slug', 'reference'],
2096
+ orderBy: {
2097
+ reference: 'asc',
2098
+ },
2099
+ })).pipe(concatMap(async (categories) => {
2100
+ const categoriesN1 = categories.data;
2101
+ const menu = [];
2102
+ for (const cat of categoriesN1) {
2103
+ const catTree = (await this.categoryRepository.getChildren(parseInt(cat.id)));
2104
+ const nivel2 = catTree
2105
+ .filter((category2) => category2.parent_id.toString() === cat.id)
2106
+ .map((category2) => {
2107
+ const nivel3 = catTree.filter((category) => category.parent_id.toString() === category2.id.toString());
2108
+ return {
2109
+ ...category2,
2110
+ children: nivel3,
2111
+ };
2112
+ });
2113
+ menu.push({
2114
+ ...cat,
2115
+ children: nivel2,
2116
+ });
2117
+ }
2118
+ return menu;
2119
+ }));
2120
+ }
2088
2121
  get gender() {
2089
2122
  return this.homeId === 'mens_market' ? 'masculino' : undefined;
2090
2123
  }