@infrab4a/connect 0.16.3-beta.0 → 0.16.3-beta.1
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/bundles/infrab4a-connect.umd.js +8 -50
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/users/models/user.d.ts +1 -0
- package/esm2015/domain/users/models/user.js +1 -1
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +7 -20
- package/fesm2015/infrab4a-connect.js +6 -18
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -2224,56 +2224,14 @@
|
|
|
2224
2224
|
};
|
|
2225
2225
|
CategoryFirestoreRepository.prototype.mountCategory = function (category, options) {
|
|
2226
2226
|
return __awaiter(this, void 0, void 0, function () {
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
products = [];
|
|
2236
|
-
publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
2237
|
-
_b.label = 1;
|
|
2238
|
-
case 1:
|
|
2239
|
-
_b.trys.push([1, 7, 8, 9]);
|
|
2240
|
-
chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next();
|
|
2241
|
-
_b.label = 2;
|
|
2242
|
-
case 2:
|
|
2243
|
-
if (!!chunks_1_1.done) return [3 /*break*/, 6];
|
|
2244
|
-
productIds = chunks_1_1.value;
|
|
2245
|
-
if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
|
|
2246
|
-
return [3 /*break*/, 6];
|
|
2247
|
-
return [4 /*yield*/, this.collection('products').where(publishedField, '==', true).where('id', 'in', productIds)];
|
|
2248
|
-
case 3:
|
|
2249
|
-
query = _b.sent();
|
|
2250
|
-
if (options === null || options === void 0 ? void 0 : options.hasStock)
|
|
2251
|
-
query = query.where('stock.quantity', '>', 0);
|
|
2252
|
-
if (options === null || options === void 0 ? void 0 : options.limit)
|
|
2253
|
-
query = query.limit(options === null || options === void 0 ? void 0 : options.limit);
|
|
2254
|
-
return [4 /*yield*/, query.get()];
|
|
2255
|
-
case 4:
|
|
2256
|
-
productSnap = _b.sent();
|
|
2257
|
-
if (productSnap.empty)
|
|
2258
|
-
return [3 /*break*/, 5];
|
|
2259
|
-
products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
|
|
2260
|
-
_b.label = 5;
|
|
2261
|
-
case 5:
|
|
2262
|
-
chunks_1_1 = chunks_1.next();
|
|
2263
|
-
return [3 /*break*/, 2];
|
|
2264
|
-
case 6: return [3 /*break*/, 9];
|
|
2265
|
-
case 7:
|
|
2266
|
-
e_1_1 = _b.sent();
|
|
2267
|
-
e_1 = { error: e_1_1 };
|
|
2268
|
-
return [3 /*break*/, 9];
|
|
2269
|
-
case 8:
|
|
2270
|
-
try {
|
|
2271
|
-
if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
|
|
2272
|
-
}
|
|
2273
|
-
finally { if (e_1) throw e_1.error; }
|
|
2274
|
-
return [7 /*endfinally*/];
|
|
2275
|
-
case 9: return [2 /*return*/, products];
|
|
2276
|
-
}
|
|
2227
|
+
return __generator(this, function (_a) {
|
|
2228
|
+
if (!category.products)
|
|
2229
|
+
throw new RequiredArgumentError(['Category products is empty']);
|
|
2230
|
+
return [2 /*return*/, this.productsIndex.findById(category.products, {
|
|
2231
|
+
hasStock: options === null || options === void 0 ? void 0 : options.hasStock,
|
|
2232
|
+
size: options === null || options === void 0 ? void 0 : options.limit,
|
|
2233
|
+
shop: category.shop,
|
|
2234
|
+
})];
|
|
2277
2235
|
});
|
|
2278
2236
|
});
|
|
2279
2237
|
};
|