sr-npm 1.7.53 → 1.7.55
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 +6 -6
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -6,8 +6,9 @@ const { getAllPositions } = require('./queries');
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
async function saveJobsDataToCMS() {
|
|
9
|
-
console.log('
|
|
9
|
+
console.log('saveJobsDataToCMS is called');
|
|
10
10
|
const positions = await fetchPositionsFromSRAPI();
|
|
11
|
+
console.log('after fetchPositionsFromSRAPI');
|
|
11
12
|
// bulk insert to jobs collection without descriptions first
|
|
12
13
|
const jobsData = positions.content.map(position => {
|
|
13
14
|
const basicJob = {
|
|
@@ -25,9 +26,12 @@ async function saveJobsDataToCMS() {
|
|
|
25
26
|
return basicJob;
|
|
26
27
|
});
|
|
27
28
|
|
|
29
|
+
console.log('i am here@@@@@@@@ ', );
|
|
28
30
|
const chunkSize = 1000;
|
|
29
31
|
let totalSaved = 0;
|
|
30
32
|
const totalChunks = Math.ceil(jobsData.length / chunkSize);
|
|
33
|
+
console.log('jobsData is ', jobsData);
|
|
34
|
+
console.log('totalChunks is ', totalChunks);
|
|
31
35
|
|
|
32
36
|
console.log(
|
|
33
37
|
`Processing ${jobsData.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
|
|
@@ -152,9 +156,6 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
152
156
|
let results = await getAllPositions();
|
|
153
157
|
await iterateOverAllJobs(results, field, jobsPerField, cityLocations);
|
|
154
158
|
const toSave = prepateToSaveArray(jobsPerField, cityLocations, field);
|
|
155
|
-
console.log('jobsPerField is@@@@@@@@ ', jobsPerField);
|
|
156
|
-
console.log('cityLocations is@@@@@@@@ ', cityLocations);
|
|
157
|
-
console.log('toSave is@@@@@@@@ ', toSave);
|
|
158
159
|
if (toSave.length === 0) {
|
|
159
160
|
console.log('No jobs found.');
|
|
160
161
|
return { success: true, message: 'No jobs to save.' };
|
|
@@ -195,8 +196,7 @@ async function referenceJobsToField({ referenceField, sourceCollection, jobField
|
|
|
195
196
|
// Fetch all jobs
|
|
196
197
|
let jobsResults = await getAllPositions();
|
|
197
198
|
let jobsToUpdate = [];
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
for (const job of jobsResults) {
|
|
201
201
|
const refId = sourceMap[job[jobField]];
|
|
202
202
|
if (refId) {
|