sr-npm 1.7.1323 → 1.7.1325
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 +9 -4
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -165,9 +165,10 @@ async function retrieveJobsData() {
|
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
if (siteconfig.customFields==="true") {
|
|
168
|
-
|
|
168
|
+
console.log("populating custom fields and values collections");
|
|
169
169
|
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
170
170
|
await populateCustomValuesCollection(customFieldsValues);
|
|
171
|
+
console.log("populated custom fields and values collections successfully");
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
@@ -195,6 +196,8 @@ async function populateCustomFieldsCollection(customFields,templateType) {
|
|
|
195
196
|
_id: ID,
|
|
196
197
|
})
|
|
197
198
|
}
|
|
199
|
+
|
|
200
|
+
console.log("fieldstoinsert: cusotmfields ", fieldstoinsert);
|
|
198
201
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
|
|
199
202
|
}
|
|
200
203
|
async function populateCustomValuesCollection(customFieldsValues) {
|
|
@@ -213,6 +216,7 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
213
216
|
})
|
|
214
217
|
}
|
|
215
218
|
}
|
|
219
|
+
console.log("valuesToinsert: customFieldsValues ", valuesToinsert);
|
|
216
220
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_VALUES, valuesToinsert);
|
|
217
221
|
}
|
|
218
222
|
|
|
@@ -408,7 +412,7 @@ async function syncJobsFast() {
|
|
|
408
412
|
try{
|
|
409
413
|
console.log("Syncing jobs fast");
|
|
410
414
|
await createCollections();
|
|
411
|
-
|
|
415
|
+
|
|
412
416
|
await fillSecretManagerMirror();
|
|
413
417
|
|
|
414
418
|
console.log("retrieving jobs data from SR API");
|
|
@@ -420,9 +424,9 @@ async function syncJobsFast() {
|
|
|
420
424
|
console.log("retrieving jobs descriptions and location apply url from SR API");
|
|
421
425
|
|
|
422
426
|
const status=await retrieveJobsDescriptionsAndLocationApplyUrlReferences(jobsData);
|
|
423
|
-
throw new Error("test");
|
|
424
427
|
if(status.success){
|
|
425
|
-
|
|
428
|
+
|
|
429
|
+
await clearCollections();
|
|
426
430
|
const updatedJobs=status.updatedJobs;
|
|
427
431
|
console.log("saving jobs to CMS");
|
|
428
432
|
await saveJobsToCMS(updatedJobs);
|
|
@@ -495,6 +499,7 @@ async function clearCollections() {
|
|
|
495
499
|
wixData.truncate(COLLECTIONS.CITIES),
|
|
496
500
|
wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
497
501
|
wixData.truncate(COLLECTIONS.BRANDS),
|
|
502
|
+
wixData.truncate(COLLECTIONS.JOBS),
|
|
498
503
|
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_VALUES) : null,
|
|
499
504
|
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_FIELDS) : null,
|
|
500
505
|
]);
|