sr-npm 1.7.1315 → 1.7.1317
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 +13 -11
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -245,6 +245,7 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
245
245
|
|
|
246
246
|
async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNoDescriptions) {
|
|
247
247
|
console.log('🚀 Starting job descriptions update process for ALL jobs');
|
|
248
|
+
console.log("jobsWithNoDescriptions: ",jobsWithNoDescriptions);
|
|
248
249
|
|
|
249
250
|
try {
|
|
250
251
|
// let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
@@ -266,23 +267,23 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
266
267
|
// let totalFailed = 0;
|
|
267
268
|
// let totalProcessed = 0;
|
|
268
269
|
|
|
269
|
-
console.log(
|
|
270
|
-
|
|
271
|
-
);
|
|
270
|
+
// console.log(
|
|
271
|
+
// `Total jobs in database without descriptions: ${jobsWithNoDescriptions?.length}`
|
|
272
|
+
// );
|
|
272
273
|
|
|
273
|
-
if (jobsWithNoDescriptions.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
274
|
+
// if (jobsWithNoDescriptions.length === 0) {
|
|
275
|
+
// console.log('No jobs found in database');
|
|
276
|
+
// return { success: true, message: 'No jobs found' };
|
|
277
|
+
// }
|
|
277
278
|
|
|
278
279
|
|
|
279
280
|
// const API_CHUNK_SIZE = 80;
|
|
280
281
|
//const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
281
282
|
const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
|
|
282
283
|
|
|
283
|
-
jobsWithNoDescriptions=jobsWithNoDescriptions.map(async job => {
|
|
284
|
-
const jobDetails =
|
|
285
|
-
const richContentDescription=await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
284
|
+
jobsWithNoDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
|
|
285
|
+
const jobDetails = await fetchJobDescription(job._id);
|
|
286
|
+
const richContentDescription= await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
286
287
|
const jobLocation = fetchJobLocation(jobDetails);
|
|
287
288
|
const {applyLink , referFriendLink} = fetchApplyAndReferFriendLink(jobDetails);
|
|
288
289
|
const updatedJob = {
|
|
@@ -293,7 +294,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
293
294
|
referFriendLink: referFriendLink,
|
|
294
295
|
};
|
|
295
296
|
return updatedJob;
|
|
296
|
-
})
|
|
297
|
+
}))
|
|
298
|
+
console.log("jobsWithNoDescriptions: after map ",jobsWithNoDescriptions);
|
|
297
299
|
return {success: true, updatedJobs: jobsWithNoDescriptions};
|
|
298
300
|
|
|
299
301
|
// await chunkedBulkOperation({
|