sr-npm 1.7.1317 → 1.7.1319
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 +26 -13
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -250,18 +250,18 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
250
250
|
try {
|
|
251
251
|
// let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
252
252
|
|
|
253
|
-
if (siteconfig.customFields==="true") {
|
|
254
|
-
|
|
253
|
+
// if (siteconfig.customFields==="true") {
|
|
254
|
+
// let customValues = await getAllCustomValues();
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
// console.log("inserting jobs references to custom values collection");
|
|
257
|
+
// console.log("customValues: ",customValues)
|
|
258
|
+
// console.log("customValues.items: ",customValues.items)
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
260
|
+
// for (const value of customValues.items) {
|
|
261
|
+
// await insertJobsReference(value._id, value.valueId);
|
|
262
|
+
// }
|
|
263
|
+
// console.log("inserted jobs references to custom values collection successfully");
|
|
264
|
+
// }
|
|
265
265
|
|
|
266
266
|
// let totalUpdated = 0;
|
|
267
267
|
// let totalFailed = 0;
|
|
@@ -281,7 +281,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
281
281
|
//const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
282
282
|
const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
|
|
283
283
|
|
|
284
|
-
|
|
284
|
+
console.log("before promise all")
|
|
285
|
+
const jobsWithDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
|
|
285
286
|
const jobDetails = await fetchJobDescription(job._id);
|
|
286
287
|
const richContentDescription= await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
287
288
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
@@ -295,8 +296,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
295
296
|
};
|
|
296
297
|
return updatedJob;
|
|
297
298
|
}))
|
|
298
|
-
console.log("
|
|
299
|
-
return {success: true, updatedJobs:
|
|
299
|
+
console.log("jobsWithDescriptions: after map ",jobsWithDescriptions);
|
|
300
|
+
return {success: true, updatedJobs: jobsWithDescriptions};
|
|
300
301
|
|
|
301
302
|
// await chunkedBulkOperation({
|
|
302
303
|
// items: jobsWithNoDescriptions.items,
|
|
@@ -568,6 +569,18 @@ async function syncJobsFast() {
|
|
|
568
569
|
},
|
|
569
570
|
});
|
|
570
571
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${updatedJobs.length}`);
|
|
572
|
+
if (siteconfig.customFields==="true") {
|
|
573
|
+
let customValues = await getAllCustomValues();
|
|
574
|
+
|
|
575
|
+
console.log("inserting jobs references to custom values collection");
|
|
576
|
+
console.log("customValues: ",customValues)
|
|
577
|
+
console.log("customValues.items: ",customValues.items)
|
|
578
|
+
|
|
579
|
+
for (const value of customValues.items) {
|
|
580
|
+
await insertJobsReference(value._id, value.valueId);
|
|
581
|
+
}
|
|
582
|
+
console.log("inserted jobs references to custom values collection successfully");
|
|
583
|
+
}
|
|
571
584
|
}
|
|
572
585
|
console.log("saved jobs descriptions and location apply url to CMS successfully");//change comment
|
|
573
586
|
|