rerobe-js-orm 2.4.78 → 2.4.79
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.
|
@@ -12,6 +12,9 @@ export default class ReRobeProductHelpers {
|
|
|
12
12
|
static prepareProductForMutation(productObj: CompleteProduct, mediaInputArr?: {
|
|
13
13
|
originalSource: string;
|
|
14
14
|
}[]): CompleteProduct;
|
|
15
|
+
static createTimestampsForStates(productObj: CompleteProduct): {
|
|
16
|
+
[key: string]: number;
|
|
17
|
+
};
|
|
15
18
|
static getSubtitle(title: string): string;
|
|
16
19
|
static sizeFinder(sizeLabel: string, sizeToMatch: string): boolean;
|
|
17
20
|
static convertReRobeSizeToStandardSize(productObj: CompleteProduct): string;
|
|
@@ -223,6 +223,73 @@ class ReRobeProductHelpers {
|
|
|
223
223
|
}
|
|
224
224
|
return productObjClone;
|
|
225
225
|
}
|
|
226
|
+
static createTimestampsForStates(productObj) {
|
|
227
|
+
const docFieldsToUpdate = {};
|
|
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;
|
|
230
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellRequestReviewDraft && !sellRequestReviewDraftTimestamp) {
|
|
231
|
+
docFieldsToUpdate.sellRequestReviewDraftTimestamp = new Date().getTime();
|
|
232
|
+
}
|
|
233
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellRequestReview && !sellRequestReviewTimestamp) {
|
|
234
|
+
docFieldsToUpdate.sellRequestReviewTimestamp = new Date().getTime();
|
|
235
|
+
}
|
|
236
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.rejected && !rejectedTimestamp) {
|
|
237
|
+
docFieldsToUpdate.rejectedTimestamp = new Date().getTime();
|
|
238
|
+
}
|
|
239
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.hold && !holdTimestamp) {
|
|
240
|
+
docFieldsToUpdate.holdTimestamp = new Date().getTime();
|
|
241
|
+
}
|
|
242
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.accepted && !acceptedTimestamp) {
|
|
243
|
+
docFieldsToUpdate.acceptedTimestamp = new Date().getTime();
|
|
244
|
+
}
|
|
245
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellerToDropOff && !sellerToDropOffTimestamp) {
|
|
246
|
+
docFieldsToUpdate.sellerToDropOffTimestamp = new Date().getTime();
|
|
247
|
+
}
|
|
248
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellerToShip && !sellerToShipTimestamp) {
|
|
249
|
+
docFieldsToUpdate.sellerToShipTimestamp = new Date().getTime();
|
|
250
|
+
}
|
|
251
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellerToGetPickUp && !sellerToGetPickUpTimestamp) {
|
|
252
|
+
docFieldsToUpdate.sellerToGetPickUpTimestamp = new Date().getTime();
|
|
253
|
+
}
|
|
254
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.qualityControl && !qualityControlTimestamp) {
|
|
255
|
+
docFieldsToUpdate.qualityControlTimestamp = new Date().getTime();
|
|
256
|
+
}
|
|
257
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.pendingPublication && !pendingPublicationTimestamp) {
|
|
258
|
+
docFieldsToUpdate.pendingPublicationTimestamp = new Date().getTime();
|
|
259
|
+
}
|
|
260
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.listed && !listedTimestamp) {
|
|
261
|
+
docFieldsToUpdate.listedTimestamp = new Date().getTime();
|
|
262
|
+
}
|
|
263
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.clearance && !clearanceTimestamp) {
|
|
264
|
+
docFieldsToUpdate.clearanceTimestamp = new Date().getTime();
|
|
265
|
+
}
|
|
266
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.reserved && !reservedTimestamp) {
|
|
267
|
+
docFieldsToUpdate.reservedTimestamp = new Date().getTime();
|
|
268
|
+
}
|
|
269
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sold && !soldTimestamp) {
|
|
270
|
+
docFieldsToUpdate.soldTimestamp = new Date().getTime();
|
|
271
|
+
}
|
|
272
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.soldSellerToBePaid && !soldSellerToBePaidTimestamp) {
|
|
273
|
+
docFieldsToUpdate.soldSellerToBePaidTimestamp = new Date().getTime();
|
|
274
|
+
}
|
|
275
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.soldSellerPaid && !soldSellerPaidTimestamp) {
|
|
276
|
+
docFieldsToUpdate.soldSellerPaidTimestamp = new Date().getTime();
|
|
277
|
+
}
|
|
278
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.returned && !returnedTimestamp) {
|
|
279
|
+
docFieldsToUpdate.returnedTimestamp = new Date().getTime();
|
|
280
|
+
}
|
|
281
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellerSelfReject && !sellerSelfRejectTimestamp) {
|
|
282
|
+
docFieldsToUpdate.sellerSelfRejectTimestamp = new Date().getTime();
|
|
283
|
+
}
|
|
284
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.liquidationRequested && !liquidationRequestedTimestamp) {
|
|
285
|
+
docFieldsToUpdate.liquidationRequestedTimestamp = new Date().getTime();
|
|
286
|
+
}
|
|
287
|
+
if (status === ProductStateManager_1.default.PRODUCT_STATES.sellerLiquidated && !sellerLiquidatedTimestamp) {
|
|
288
|
+
docFieldsToUpdate.sellerLiquidatedTimestamp = new Date().getTime();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return docFieldsToUpdate;
|
|
292
|
+
}
|
|
226
293
|
static getSubtitle(title) {
|
|
227
294
|
if (typeof title === 'string' && title.trim()) {
|
|
228
295
|
return title.split('by')[0].trim();
|