sr-npm 1.7.1318 → 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.
Files changed (2) hide show
  1. package/backend/data.js +45 -45
  2. package/package.json +1 -1
package/backend/data.js CHANGED
@@ -282,7 +282,7 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
282
282
  const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
283
283
 
284
284
  console.log("before promise all")
285
- jobsWithNoDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
285
+ const jobsWithDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
286
286
  const jobDetails = await fetchJobDescription(job._id);
287
287
  const richContentDescription= await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
288
288
  const jobLocation = fetchJobLocation(jobDetails);
@@ -296,8 +296,8 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
296
296
  };
297
297
  return updatedJob;
298
298
  }))
299
- console.log("jobsWithNoDescriptions: after map ",jobsWithNoDescriptions);
300
- return {success: true, updatedJobs: jobsWithNoDescriptions};
299
+ console.log("jobsWithDescriptions: after map ",jobsWithDescriptions);
300
+ return {success: true, updatedJobs: jobsWithDescriptions};
301
301
 
302
302
  // await chunkedBulkOperation({
303
303
  // items: jobsWithNoDescriptions.items,
@@ -539,49 +539,49 @@ async function syncJobsFast() {
539
539
  const status=await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsData);
540
540
 
541
541
  console.log("status inside syncJobsFast: ",status);
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
- // );
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
+ );
552
552
 
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
- // }
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
+ }
585
585
  console.log("saved jobs descriptions and location apply url to CMS successfully");//change comment
586
586
 
587
587
  await aggregateJobs();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.1318",
3
+ "version": "1.7.1319",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {