@infrab4a/connect 3.2.1 → 3.2.3
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 +37 -2
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +26 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +13 -3
- package/fesm2015/infrab4a-connect.js +36 -2
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +6 -1
- package/package.json +1 -1
|
@@ -2684,10 +2684,35 @@
|
|
|
2684
2684
|
function OrderFirestoreRepository(firestore) {
|
|
2685
2685
|
var _this = _super.call(this) || this;
|
|
2686
2686
|
_this.firestore = firestore;
|
|
2687
|
+
_this.orderFromFirestore = function (order, id) {
|
|
2688
|
+
var _a;
|
|
2689
|
+
var modifiedOrder = _this.model.toInstance(Object.assign(Object.assign({}, order), { id: id }));
|
|
2690
|
+
if (!!((_a = modifiedOrder === null || modifiedOrder === void 0 ? void 0 : modifiedOrder.lineItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2691
|
+
modifiedOrder.lineItems = modifiedOrder.lineItems.map(function (lineItem) {
|
|
2692
|
+
if (!!lineItem.price[modifiedOrder.shop]) {
|
|
2693
|
+
var shopPrice = lineItem['price'][modifiedOrder.shop];
|
|
2694
|
+
lineItem['price'] = shopPrice;
|
|
2695
|
+
}
|
|
2696
|
+
return lineItem;
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
return modifiedOrder;
|
|
2700
|
+
};
|
|
2687
2701
|
_this.collectionName = 'orders';
|
|
2688
2702
|
_this.model = Order;
|
|
2689
2703
|
return _this;
|
|
2690
2704
|
}
|
|
2705
|
+
OrderFirestoreRepository.prototype.buildModelInstance = function () {
|
|
2706
|
+
var _this = this;
|
|
2707
|
+
var _b = _super.prototype.buildModelInstance.call(this), fromFirestore = _b.fromFirestore, toFirestore = _b.toFirestore;
|
|
2708
|
+
return {
|
|
2709
|
+
toFirestore: function (data) { return toFirestore((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data); },
|
|
2710
|
+
fromFirestore: function (snap) {
|
|
2711
|
+
var instance = fromFirestore(snap);
|
|
2712
|
+
return _this.orderFromFirestore(instance, snap.id);
|
|
2713
|
+
},
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2691
2716
|
return OrderFirestoreRepository;
|
|
2692
2717
|
}(withCrudFirestore(withHelpers(withFirestore(Base)))));
|
|
2693
2718
|
|
|
@@ -3994,8 +4019,18 @@
|
|
|
3994
4019
|
{ howToUse: { columnName: 'how_to_use' } },
|
|
3995
4020
|
{ brandDescription: { columnName: 'brand_description' } },
|
|
3996
4021
|
{ hasVariants: { columnName: 'has_variants' } },
|
|
3997
|
-
{
|
|
3998
|
-
|
|
4022
|
+
{
|
|
4023
|
+
images: {
|
|
4024
|
+
columnName: 'images',
|
|
4025
|
+
to: function (value) { var _a; return ((value === null || value === void 0 ? void 0 : value.length) > 0 ? "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}" : "{}"); },
|
|
4026
|
+
},
|
|
4027
|
+
},
|
|
4028
|
+
{
|
|
4029
|
+
miniatures: {
|
|
4030
|
+
columnName: 'miniatures',
|
|
4031
|
+
to: function (value) { var _a; return ((value === null || value === void 0 ? void 0 : value.length) > 0 ? "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}" : "{}"); },
|
|
4032
|
+
},
|
|
4033
|
+
},
|
|
3999
4034
|
'name',
|
|
4000
4035
|
{
|
|
4001
4036
|
price: {
|