sr-npm 1.7.1316 → 1.7.1318

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.
Files changed (2) hide show
  1. package/backend/data.js +58 -44
  2. 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
- let customValues = await getAllCustomValues();
253
+ // if (siteconfig.customFields==="true") {
254
+ // let customValues = await getAllCustomValues();
255
255
 
256
- console.log("inserting jobs references to custom values collection");
257
- console.log("customValues: ",customValues)
258
- console.log("customValues.items: ",customValues.items)
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
- 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
- }
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,9 +281,10 @@ 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
- jobsWithNoDescriptions=jobsWithNoDescriptions.map(async job => {
285
- const jobDetails = await fetchJobDescription(job._id);
286
- const richContentDescription=await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
284
+ console.log("before promise all")
285
+ jobsWithNoDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
286
+ const jobDetails = await fetchJobDescription(job._id);
287
+ const richContentDescription= await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
287
288
  const jobLocation = fetchJobLocation(jobDetails);
288
289
  const {applyLink , referFriendLink} = fetchApplyAndReferFriendLink(jobDetails);
289
290
  const updatedJob = {
@@ -294,7 +295,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
294
295
  referFriendLink: referFriendLink,
295
296
  };
296
297
  return updatedJob;
297
- })
298
+ }))
299
+ console.log("jobsWithNoDescriptions: after map ",jobsWithNoDescriptions);
298
300
  return {success: true, updatedJobs: jobsWithNoDescriptions};
299
301
 
300
302
  // await chunkedBulkOperation({
@@ -537,37 +539,49 @@ async function syncJobsFast() {
537
539
  const status=await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsData);
538
540
 
539
541
  console.log("status inside syncJobsFast: ",status);
540
- if(status.success){
541
- await clearCollections();
542
- const updatedJobs=status.updatedJobs;
543
- const chunkSize = 1000;
544
- let totalSaved = 0;
545
- const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
546
-
547
- console.log(
548
- `Processing ${updatedJobs.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
549
- );
542
+ // if(status.success){
543
+ // await clearCollections();
544
+ // const updatedJobs=status.updatedJobs;
545
+ // const chunkSize = 1000;
546
+ // let totalSaved = 0;
547
+ // const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
548
+
549
+ // console.log(
550
+ // `Processing ${updatedJobs.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
551
+ // );
550
552
 
551
- await chunkedBulkOperation({
552
- items: updatedJobs,
553
- chunkSize,
554
- processChunk: async (chunk, chunkNumber) => {
555
- console.log(`Saving chunk ${chunkNumber}/${totalChunks}: ${chunk.length} jobs`);
556
- try {
557
- const result = await wixData.bulkSave(COLLECTIONS.JOBS, chunk);
558
- const saved = result.inserted + result.updated || chunk.length;
559
- totalSaved += saved;
560
- console.log(
561
- `✓ Chunk ${chunkNumber} saved successfully. Inserted: ${result.inserted}, Updated: ${result.updated}`
562
- );
563
- } catch (error) {
564
- console.error(`✗ Error saving chunk ${chunkNumber}:`, error);
565
- throw error;
566
- }
567
- },
568
- });
569
- console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${updatedJobs.length}`);
570
- }
553
+ // await chunkedBulkOperation({
554
+ // items: updatedJobs,
555
+ // chunkSize,
556
+ // processChunk: async (chunk, chunkNumber) => {
557
+ // console.log(`Saving chunk ${chunkNumber}/${totalChunks}: ${chunk.length} jobs`);
558
+ // try {
559
+ // const result = await wixData.bulkSave(COLLECTIONS.JOBS, chunk);
560
+ // const saved = result.inserted + result.updated || chunk.length;
561
+ // totalSaved += saved;
562
+ // console.log(
563
+ // `✓ Chunk ${chunkNumber} saved successfully. Inserted: ${result.inserted}, Updated: ${result.updated}`
564
+ // );
565
+ // } catch (error) {
566
+ // console.error(`✗ Error saving chunk ${chunkNumber}:`, error);
567
+ // throw error;
568
+ // }
569
+ // },
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
+ // }
584
+ // }
571
585
  console.log("saved jobs descriptions and location apply url to CMS successfully");//change comment
572
586
 
573
587
  await aggregateJobs();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.1316",
3
+ "version": "1.7.1318",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {