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