rerobe-js-orm 4.6.7 → 4.6.8
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/lib/models/Product.js
CHANGED
|
@@ -580,18 +580,8 @@ class Product extends Base_1.default {
|
|
|
580
580
|
stockTakeFirstTimestamp: null,
|
|
581
581
|
};
|
|
582
582
|
const stockDerivations = this.deriveStockTimestampsFromSystemTags();
|
|
583
|
-
stagedObj.
|
|
584
|
-
|
|
585
|
-
if (stagedObj.stockStatusTimestamp &&
|
|
586
|
-
stagedObj.stockStatusTimestamp === stockDerivations.stockTakeLatestTimestamp) {
|
|
587
|
-
stagedObj.stockStatus = 'In stock';
|
|
588
|
-
}
|
|
589
|
-
else if (stagedObj.stockStatusTimestamp) {
|
|
590
|
-
stagedObj.stockStatus = 'In transit';
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
stagedObj.stockStatus = '';
|
|
594
|
-
}
|
|
583
|
+
stagedObj.stockStatus = this.utilities.sanitizeString(this.filterAttributes.stockStatus);
|
|
584
|
+
stagedObj.stockStatusTimestamp = this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.stockStatusTimestamp);
|
|
595
585
|
stagedObj.stockTakeFirstTimestamp = this.utilities.sanitizeMillisTimeStamp(stockDerivations.stockTakeFirstTimestamp);
|
|
596
586
|
stagedObj.stockTakeLatestTimestamp = this.utilities.sanitizeMillisTimeStamp(stockDerivations.stockTakeLatestTimestamp);
|
|
597
587
|
if (((_a = this.consignmentAttributes) === null || _a === void 0 ? void 0 : _a.inventoryLocations) &&
|
|
@@ -641,25 +631,15 @@ class Product extends Base_1.default {
|
|
|
641
631
|
const stockTakeLatest = parseLatestAndFirstTs(stockTakeTags).latest;
|
|
642
632
|
const inTransitLatest = parseLatestAndFirstTs(inTransitTags).latest;
|
|
643
633
|
const stockTakeLatestSan = stockTakeLatest ? this.utilities.sanitizeMillisTimeStamp(stockTakeLatest) : null;
|
|
634
|
+
const inTransitLatestSan = inTransitLatest ? this.utilities.sanitizeMillisTimeStamp(inTransitLatest) : null;
|
|
644
635
|
const stockTakeFirstRaw = stockTakeTags.length ? parseLatestAndFirstTs(stockTakeTags).first : 0;
|
|
645
636
|
const stockTakeFirstSan = stockTakeFirstRaw ? this.utilities.sanitizeMillisTimeStamp(stockTakeFirstRaw) : null;
|
|
646
|
-
let stockStatusTimestamp = null;
|
|
647
|
-
if (stockTakeLatest === 0 && inTransitLatest === 0) {
|
|
648
|
-
stockStatusTimestamp = null;
|
|
649
|
-
}
|
|
650
|
-
else if (stockTakeLatest >= inTransitLatest) {
|
|
651
|
-
stockStatusTimestamp = stockTakeLatestSan;
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
stockStatusTimestamp = this.utilities.sanitizeMillisTimeStamp(inTransitLatest);
|
|
655
|
-
}
|
|
656
|
-
this.timestampAttributes.stockStatusTimestamp = stockStatusTimestamp;
|
|
657
637
|
this.timestampAttributes.stockTakeFirstTimestamp = stockTakeFirstSan;
|
|
658
638
|
this.timestampAttributes.stockTakeLatestTimestamp = stockTakeLatestSan;
|
|
659
639
|
return {
|
|
660
640
|
stockTakeFirstTimestamp: stockTakeFirstSan,
|
|
661
641
|
stockTakeLatestTimestamp: stockTakeLatestSan,
|
|
662
|
-
|
|
642
|
+
inTransitLatestTimestamp: inTransitLatestSan,
|
|
663
643
|
};
|
|
664
644
|
}
|
|
665
645
|
buildUpdatedFieldsForSalesChannel() {
|
|
@@ -371,7 +371,7 @@ type TypesenseProductObj = {
|
|
|
371
371
|
description: string;
|
|
372
372
|
discountType: string;
|
|
373
373
|
discountValue: number;
|
|
374
|
-
stockStatus:
|
|
374
|
+
stockStatus: string;
|
|
375
375
|
stockStatusTimestamp: number | null;
|
|
376
376
|
id: string;
|
|
377
377
|
documentId: string;
|