sr-npm 1.7.41 → 1.7.43
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 +4 -3
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
2
|
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
const { chunkedBulkOperation, delay, countJobsPerGivenField, fillCityLocation ,prepateToSaveArray,normalizeCityName} = require('./utils');
|
|
4
|
-
const { QUERY_MAX_LIMIT
|
|
4
|
+
const { QUERY_MAX_LIMIT } = require('./consts');
|
|
5
5
|
const { getAllPositions } = require('./queries');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
async function saveJobsDataToCMS() {
|
|
10
|
+
console.log('test!@##@@#@!#@!!#@@!#@!#@!@!!@#!@#!@!@!@#!@#@#!!@##!@#!@!@#@!#@!##!@');
|
|
10
11
|
const positions = await fetchPositionsFromSRAPI();
|
|
11
12
|
// bulk insert to jobs collection without descriptions first
|
|
12
13
|
const jobsData = positions.content.map(position => {
|
|
@@ -93,7 +94,7 @@ async function saveJobsDescriptionsAndLocationToCMS() {
|
|
|
93
94
|
locationAddress: jobLocation,
|
|
94
95
|
jobDescription: jobDetails.jobAd.sections,
|
|
95
96
|
};
|
|
96
|
-
await wixData.update(
|
|
97
|
+
await wixData.update('Jobs1', updatedJob);
|
|
97
98
|
return { success: true, jobId: job._id, title: job.title };
|
|
98
99
|
} catch (error) {
|
|
99
100
|
console.error(` ❌ Failed to update ${job.title} (${job._id}):`, error);
|
|
@@ -177,7 +178,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
177
178
|
|
|
178
179
|
async function getJobsWithNoDescriptions() {
|
|
179
180
|
let jobswithoutdescriptionsQuery = await wixData
|
|
180
|
-
.query(
|
|
181
|
+
.query('Jobs1')
|
|
181
182
|
.limit(QUERY_MAX_LIMIT)
|
|
182
183
|
.isEmpty('jobDescription')
|
|
183
184
|
.find();
|