sr-npm 1.7.1319 → 1.7.1320
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/backend/data.js +12 -3
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -165,8 +165,11 @@ async function saveJobsDataToCMS() {
|
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
if (siteconfig.customFields==="true") {
|
|
168
|
+
console.log("populating custom fields collection");
|
|
168
169
|
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
170
|
+
console.log("populating custom values collection");
|
|
169
171
|
await populateCustomValuesCollection(customFieldsValues);
|
|
172
|
+
console.log("populated custom fields and values collections successfully");
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
@@ -527,7 +530,7 @@ async function syncJobsFast() {
|
|
|
527
530
|
try{
|
|
528
531
|
console.log("Syncing jobs fast");
|
|
529
532
|
await createCollections();
|
|
530
|
-
|
|
533
|
+
await clearCollections();
|
|
531
534
|
await fillSecretManagerMirror();
|
|
532
535
|
|
|
533
536
|
console.log("saving jobs data to CMS");//change comment
|
|
@@ -540,7 +543,8 @@ async function syncJobsFast() {
|
|
|
540
543
|
|
|
541
544
|
console.log("status inside syncJobsFast: ",status);
|
|
542
545
|
if(status.success){
|
|
543
|
-
await
|
|
546
|
+
await wixData.truncate(COLLECTIONS.JOBS)
|
|
547
|
+
//await clearCollections();
|
|
544
548
|
const updatedJobs=status.updatedJobs;
|
|
545
549
|
const chunkSize = 1000;
|
|
546
550
|
let totalSaved = 0;
|
|
@@ -570,6 +574,10 @@ async function syncJobsFast() {
|
|
|
570
574
|
});
|
|
571
575
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${updatedJobs.length}`);
|
|
572
576
|
if (siteconfig.customFields==="true") {
|
|
577
|
+
console.log("inserting jobs references to custom values collection");
|
|
578
|
+
|
|
579
|
+
//put this inside function
|
|
580
|
+
//------------------------------------------------------------------------------------------------
|
|
573
581
|
let customValues = await getAllCustomValues();
|
|
574
582
|
|
|
575
583
|
console.log("inserting jobs references to custom values collection");
|
|
@@ -581,6 +589,7 @@ async function syncJobsFast() {
|
|
|
581
589
|
}
|
|
582
590
|
console.log("inserted jobs references to custom values collection successfully");
|
|
583
591
|
}
|
|
592
|
+
//------------------------------------------------------------------------------------------------
|
|
584
593
|
}
|
|
585
594
|
console.log("saved jobs descriptions and location apply url to CMS successfully");//change comment
|
|
586
595
|
|
|
@@ -606,7 +615,7 @@ async function clearCollections() {
|
|
|
606
615
|
await Promise.all([
|
|
607
616
|
wixData.truncate(COLLECTIONS.CITIES),
|
|
608
617
|
wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
609
|
-
wixData.truncate(COLLECTIONS.JOBS),
|
|
618
|
+
//wixData.truncate(COLLECTIONS.JOBS),
|
|
610
619
|
wixData.truncate(COLLECTIONS.BRANDS),
|
|
611
620
|
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_VALUES) : null,
|
|
612
621
|
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_FIELDS) : null,
|