@infrab4a/connect-angular 5.2.2-beta.3 → 5.2.2-beta.5
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/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +10 -1
- package/esm2020/services/catalog/adapters/old-category-structure.adapter.mjs +2 -1
- package/esm2020/services/catalog/catalog.service.mjs +2 -1
- package/esm2020/services/catalog/category.service.mjs +7 -2
- package/esm2020/services/catalog/strategies/category-search.strategy.mjs +7 -1
- package/fesm2015/infrab4a-connect-angular.mjs +20 -1
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +23 -1
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1385,9 +1385,18 @@ class NewCategoryStructureAdapter {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
async buildProductFilterByCategory(category) {
|
|
1387
1387
|
const loadedCategory = await this.getCategory(category);
|
|
1388
|
+
console.warn('loadedCategory', loadedCategory);
|
|
1388
1389
|
if (loadedCategory.isCollection)
|
|
1389
1390
|
return { id: { operator: Where.IN, value: loadedCategory.products } };
|
|
1390
1391
|
const categoryIds = [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1392
|
+
console.warn('new buildProductFilterByCategory', {
|
|
1393
|
+
category: {
|
|
1394
|
+
id: {
|
|
1395
|
+
operator: Where.IN,
|
|
1396
|
+
value: categoryIds,
|
|
1397
|
+
},
|
|
1398
|
+
},
|
|
1399
|
+
});
|
|
1391
1400
|
return {
|
|
1392
1401
|
category: {
|
|
1393
1402
|
id: {
|
|
@@ -1427,6 +1436,7 @@ class OldCategoryStructureAdapter {
|
|
|
1427
1436
|
const productsIds = category.products?.length
|
|
1428
1437
|
? category.products
|
|
1429
1438
|
: await this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
|
|
1439
|
+
console.warn('old OldCategoryStructureAdapter', { id: { operator: Where.IN, value: productsIds } });
|
|
1430
1440
|
return { id: { operator: Where.IN, value: productsIds } };
|
|
1431
1441
|
}
|
|
1432
1442
|
}
|
|
@@ -1532,6 +1542,12 @@ class CategorySearchStrategy {
|
|
|
1532
1542
|
const productCatalog = this.repositoryService.getProductCatalog();
|
|
1533
1543
|
const filterHelper = this.helpersService.getFilterHelper();
|
|
1534
1544
|
const sortHelper = this.helpersService.getSortHelper();
|
|
1545
|
+
console.warn('searchDefault repoParams', {
|
|
1546
|
+
filters: {
|
|
1547
|
+
...(await productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category)),
|
|
1548
|
+
...filterHelper.buildFilterQuery(filters || {}),
|
|
1549
|
+
},
|
|
1550
|
+
});
|
|
1535
1551
|
const repoParams = {
|
|
1536
1552
|
fields,
|
|
1537
1553
|
filters: {
|
|
@@ -1821,12 +1837,17 @@ class CategoryService {
|
|
|
1821
1837
|
this.shop = shop;
|
|
1822
1838
|
}
|
|
1823
1839
|
async fetchBrands(category, options, optionsCache) {
|
|
1840
|
+
const filters = await this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category);
|
|
1841
|
+
console.warn('fetchBrands', filters);
|
|
1824
1842
|
const brands = await this.productCatalog.productRepository
|
|
1825
1843
|
.findCatalog({
|
|
1826
1844
|
filters: await this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category),
|
|
1827
1845
|
fields: ['brand'],
|
|
1828
|
-
},
|
|
1846
|
+
}, null,
|
|
1847
|
+
// options?.mainGender ? options?.mainGender : this.shop === Shops.MENSMARKET ? 'male' : 'female',
|
|
1848
|
+
optionsCache)
|
|
1829
1849
|
.then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => ({ ...brands, [brand]: true }), {})));
|
|
1850
|
+
console.warn('brands', brands);
|
|
1830
1851
|
return this.categoryFacade.categoryRepository
|
|
1831
1852
|
.find({ filters: { brandCategory: true, shop: options?.shop || this.shop }, orderBy: { name: 'asc' } }, optionsCache)
|
|
1832
1853
|
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
@@ -2164,6 +2185,7 @@ class CatalogService {
|
|
|
2164
2185
|
async fetchProducts(options, optionsCache) {
|
|
2165
2186
|
this.validateRequest(options);
|
|
2166
2187
|
const searchParams = this.buildSearchParams(options);
|
|
2188
|
+
console.warn('fetchProducts', searchParams);
|
|
2167
2189
|
const { data, count: total, maximum, minimal, distinct, } = await this.searchContext.executeSearch(searchParams, this.shop, optionsCache);
|
|
2168
2190
|
await this.helpersService.getBrandManager().setBrandsList(searchParams, distinct?.brand);
|
|
2169
2191
|
return this.buildResponse({
|