rerobe-js-orm 2.4.79 → 2.4.81

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.
@@ -226,7 +226,7 @@ class ReRobeProductHelpers {
226
226
  static createTimestampsForStates(productObj) {
227
227
  const docFieldsToUpdate = {};
228
228
  if (productObj) {
229
- const { status, sellRequestReviewDraftTimestamp, sellRequestReviewTimestamp, rejectedTimestamp, holdTimestamp, acceptedTimestamp, sellerToDropOffTimestamp, sellerToShipTimestamp, sellerToGetPickUpTimestamp, qualityControlTimestamp, pendingPublicationTimestamp, listedTimestamp, clearanceTimestamp, reservedTimestamp, soldTimestamp, soldSellerToBePaidTimestamp, soldSellerPaidTimestamp, returnedTimestamp, sellerSelfRejectTimestamp, liquidationRequestedTimestamp, sellerLiquidatedTimestamp, } = productObj;
229
+ const { dateSold, status, sellRequestReviewDraftTimestamp, sellRequestReviewTimestamp, rejectedTimestamp, holdTimestamp, acceptedTimestamp, sellerToDropOffTimestamp, sellerToShipTimestamp, sellerToGetPickUpTimestamp, qualityControlTimestamp, pendingPublicationTimestamp, listedTimestamp, clearanceTimestamp, reservedTimestamp, soldTimestamp, soldSellerToBePaidTimestamp, soldSellerPaidTimestamp, returnedTimestamp, sellerSelfRejectTimestamp, liquidationRequestedTimestamp, sellerLiquidatedTimestamp, } = productObj;
230
230
  if (status === ProductStateManager_1.default.PRODUCT_STATES.sellRequestReviewDraft && !sellRequestReviewDraftTimestamp) {
231
231
  docFieldsToUpdate.sellRequestReviewDraftTimestamp = new Date().getTime();
232
232
  }
@@ -270,10 +270,23 @@ class ReRobeProductHelpers {
270
270
  docFieldsToUpdate.soldTimestamp = new Date().getTime();
271
271
  }
272
272
  if (status === ProductStateManager_1.default.PRODUCT_STATES.soldSellerToBePaid && !soldSellerToBePaidTimestamp) {
273
- docFieldsToUpdate.soldSellerToBePaidTimestamp = new Date().getTime();
273
+ const timeNow = new Date().getTime();
274
+ docFieldsToUpdate.soldSellerToBePaidTimestamp = timeNow;
275
+ if (!soldTimestamp) {
276
+ docFieldsToUpdate.soldTimestamp =
277
+ dateSold && typeof dateSold === 'string' ? new Date(dateSold).getTime() : timeNow;
278
+ }
274
279
  }
275
280
  if (status === ProductStateManager_1.default.PRODUCT_STATES.soldSellerPaid && !soldSellerPaidTimestamp) {
276
- docFieldsToUpdate.soldSellerPaidTimestamp = new Date().getTime();
281
+ const timeNow = new Date().getTime();
282
+ docFieldsToUpdate.soldSellerPaidTimestamp = timeNow;
283
+ if (!soldSellerToBePaidTimestamp) {
284
+ docFieldsToUpdate.soldSellerToBePaidTimestamp = timeNow;
285
+ }
286
+ if (!soldTimestamp) {
287
+ docFieldsToUpdate.soldTimestamp =
288
+ dateSold && typeof dateSold === 'string' ? new Date(dateSold).getTime() : timeNow;
289
+ }
277
290
  }
278
291
  if (status === ProductStateManager_1.default.PRODUCT_STATES.returned && !returnedTimestamp) {
279
292
  docFieldsToUpdate.returnedTimestamp = new Date().getTime();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.79",
3
+ "version": "2.4.81",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",