rerobe-js-orm 3.0.12 → 3.0.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.
- package/lib/helpers/Utilities.d.ts +2 -1
- package/lib/helpers/Utilities.js +6 -3
- package/lib/models/Order.js +2 -1
- package/lib/models/Product.js +2 -1
- package/lib/models/User.js +2 -1
- package/lib/types/rerobe-order-types.d.ts +1 -0
- package/lib/types/rerobe-product-types.d.ts +1 -0
- package/lib/types/rerobe-user-types.d.ts +2 -1
- package/package.json +1 -1
package/lib/helpers/Utilities.js
CHANGED
|
@@ -149,9 +149,10 @@ class Utilities {
|
|
|
149
149
|
formatTimestamp(timestampMillis) {
|
|
150
150
|
if (typeof timestampMillis !== 'number' || Number.isNaN(new Date(timestampMillis).valueOf())) {
|
|
151
151
|
return {
|
|
152
|
+
createdAtHour: '',
|
|
152
153
|
createdAtDay: '',
|
|
153
154
|
createdAtMonth: '',
|
|
154
|
-
|
|
155
|
+
createdAtYear: '',
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
const dateObj = new Date(timestampMillis);
|
|
@@ -159,13 +160,15 @@ class Utilities {
|
|
|
159
160
|
const month = (dateObj.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are 0-indexed in JS
|
|
160
161
|
const day = dateObj.getUTCDate().toString().padStart(2, '0');
|
|
161
162
|
const hour = dateObj.getUTCHours().toString().padStart(2, '0');
|
|
163
|
+
const createdAtHour = `${year}-${month}-${day} ${hour}`;
|
|
162
164
|
const createdAtDay = `${year}-${month}-${day}`;
|
|
163
165
|
const createdAtMonth = `${year}-${month}`;
|
|
164
|
-
const
|
|
166
|
+
const createdAtYear = `${year}`;
|
|
165
167
|
return {
|
|
168
|
+
createdAtHour,
|
|
166
169
|
createdAtDay,
|
|
167
170
|
createdAtMonth,
|
|
168
|
-
|
|
171
|
+
createdAtYear,
|
|
169
172
|
};
|
|
170
173
|
}
|
|
171
174
|
}
|
package/lib/models/Order.js
CHANGED
|
@@ -335,7 +335,7 @@ class Order extends Base_1.default {
|
|
|
335
335
|
? this.lineItems[0].image.originalSrc
|
|
336
336
|
: 'https://res.cloudinary.com/ribbn/image/fetch/e_blur:1000,o_20,q_50/https://cdn.shopify.com/s/files/1/0261/9686/9172/products/7AC16810-F519-4665-8891-7163EB29FBB7_1000x1000.jpg%3Fv%3D1634827512';
|
|
337
337
|
const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp);
|
|
338
|
-
const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
338
|
+
const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
339
339
|
const stagedObj = {
|
|
340
340
|
id: this.utilities.sanitizeString(this.documentId),
|
|
341
341
|
documentId: this.utilities.sanitizeString(this.documentId),
|
|
@@ -344,6 +344,7 @@ class Order extends Base_1.default {
|
|
|
344
344
|
createdAtHour,
|
|
345
345
|
createdAtDay,
|
|
346
346
|
createdAtMonth,
|
|
347
|
+
createdAtYear,
|
|
347
348
|
updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
|
|
348
349
|
merchantId: this.utilities.sanitizeString(this.merchantId),
|
|
349
350
|
image: this.utilities.sanitizeString(image),
|
package/lib/models/Product.js
CHANGED
|
@@ -262,7 +262,7 @@ class Product extends Base_1.default {
|
|
|
262
262
|
}
|
|
263
263
|
toObjForTypesense() {
|
|
264
264
|
const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.createdAtTimestamp);
|
|
265
|
-
const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
265
|
+
const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
266
266
|
const stagedObj = {
|
|
267
267
|
brand: this.utilities.sanitizeString(this.filterAttributes.brand),
|
|
268
268
|
size: this.utilities.sanitizeString(this.filterAttributes.size),
|
|
@@ -296,6 +296,7 @@ class Product extends Base_1.default {
|
|
|
296
296
|
createdAtHour,
|
|
297
297
|
createdAtDay,
|
|
298
298
|
createdAtMonth,
|
|
299
|
+
createdAtYear,
|
|
299
300
|
updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.updatedAtTimestamp),
|
|
300
301
|
sellRequestReviewTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellRequestReviewTimestamp),
|
|
301
302
|
sellRequestReviewDraftTimestamp: this.utilities.sanitizeMillisTimeStamp(this.timestampAttributes.sellRequestReviewDraftTimestamp),
|
package/lib/models/User.js
CHANGED
|
@@ -319,7 +319,7 @@ class User extends Base_1.default {
|
|
|
319
319
|
}
|
|
320
320
|
toObjForTypesense(merchantId) {
|
|
321
321
|
const createdAtTimestamp = this.utilities.sanitizeMillisTimeStamp(this.createdAtTimestamp);
|
|
322
|
-
const { createdAtHour, createdAtDay, createdAtMonth } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
322
|
+
const { createdAtHour, createdAtDay, createdAtMonth, createdAtYear } = this.utilities.formatTimestamp(createdAtTimestamp);
|
|
323
323
|
const stagedObj = {
|
|
324
324
|
id: this.utilities.sanitizeString(this.documentId),
|
|
325
325
|
documentId: this.utilities.sanitizeString(this.documentId),
|
|
@@ -328,6 +328,7 @@ class User extends Base_1.default {
|
|
|
328
328
|
createdAtHour,
|
|
329
329
|
createdAtDay,
|
|
330
330
|
createdAtMonth,
|
|
331
|
+
createdAtYear,
|
|
331
332
|
updatedAtTimestamp: this.utilities.sanitizeMillisTimeStamp(this.updatedAtTimestamp),
|
|
332
333
|
merchantId: this.utilities.sanitizeString(merchantId),
|
|
333
334
|
firstName: this.utilities.sanitizeString(this.firstName),
|
|
@@ -164,7 +164,8 @@ declare type TypesenseUserObj = {
|
|
|
164
164
|
lastOrderTimestamp: number;
|
|
165
165
|
lastUploadTimestamp: number;
|
|
166
166
|
registrationSource: string;
|
|
167
|
+
createdAtHour: string;
|
|
167
168
|
createdAtDay: string;
|
|
168
169
|
createdAtMonth: string;
|
|
169
|
-
|
|
170
|
+
createdAtYear: string;
|
|
170
171
|
};
|