@infrab4a/connect 3.2.2 → 3.2.4

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.
@@ -2684,19 +2684,18 @@
2684
2684
  function OrderFirestoreRepository(firestore) {
2685
2685
  var _this = _super.call(this) || this;
2686
2686
  _this.firestore = firestore;
2687
- _this.orderFromFirestore = function (order, id) {
2687
+ _this.orderFromFirestore = function (order) {
2688
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];
2689
+ if (!!((_a = order === null || order === void 0 ? void 0 : order.lineItems) === null || _a === void 0 ? void 0 : _a.length)) {
2690
+ order.lineItems = order.lineItems.map(function (lineItem) {
2691
+ if (!!lineItem.price[order.shop]) {
2692
+ var shopPrice = lineItem['price'][order.shop];
2694
2693
  lineItem['price'] = shopPrice;
2695
2694
  }
2696
2695
  return lineItem;
2697
2696
  });
2698
2697
  }
2699
- return modifiedOrder;
2698
+ return order;
2700
2699
  };
2701
2700
  _this.collectionName = 'orders';
2702
2701
  _this.model = Order;
@@ -2709,7 +2708,7 @@
2709
2708
  toFirestore: function (data) { return toFirestore((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data); },
2710
2709
  fromFirestore: function (snap) {
2711
2710
  var instance = fromFirestore(snap);
2712
- return _this.orderFromFirestore(instance, snap.id);
2711
+ return _this.orderFromFirestore(instance);
2713
2712
  },
2714
2713
  };
2715
2714
  };
@@ -4019,8 +4018,18 @@
4019
4018
  { howToUse: { columnName: 'how_to_use' } },
4020
4019
  { brandDescription: { columnName: 'brand_description' } },
4021
4020
  { hasVariants: { columnName: 'has_variants' } },
4022
- { images: { columnName: 'images', to: function (value) { var _a; return "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}"; } } },
4023
- { miniatures: { columnName: 'miniatures', to: function (value) { var _a; return "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}"; } } },
4021
+ {
4022
+ images: {
4023
+ columnName: 'images',
4024
+ 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, "\",\"")) || '') + "\"}" : "{}"); },
4025
+ },
4026
+ },
4027
+ {
4028
+ miniatures: {
4029
+ columnName: 'miniatures',
4030
+ 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, "\",\"")) || '') + "\"}" : "{}"); },
4031
+ },
4032
+ },
4024
4033
  'name',
4025
4034
  {
4026
4035
  price: {