@infrab4a/connect 0.9.12 → 0.9.13

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.
@@ -1879,13 +1879,20 @@
1879
1879
  return _this;
1880
1880
  }
1881
1881
  CouponFirestoreRepository.prototype.buildModelInstance = function () {
1882
+ var _a = _super.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
1882
1883
  return {
1883
1884
  toFirestore: function (data) {
1884
- var plain = data.toPlain();
1885
- plain.expiresIn = data.expiresIn.getTime();
1885
+ var plain = toFirestore(data);
1886
+ if (!!data.expiresIn)
1887
+ plain.expiresIn = data.expiresIn.getTime();
1886
1888
  return plain;
1887
1889
  },
1888
- fromFirestore: function (snap) { return Coupon.toInstance(Object.assign(Object.assign({}, snap.data()), { expiresIn: new Date(snap.data().expiresIn) })); },
1890
+ fromFirestore: function (snap) {
1891
+ var instance = fromFirestore(snap);
1892
+ if (!lodash.isNil(instance.expiresIn))
1893
+ instance.expiresIn = new Date(snap.data().expiresIn);
1894
+ return instance;
1895
+ },
1889
1896
  };
1890
1897
  };
1891
1898
  return CouponFirestoreRepository;