sr-npm 1.7.173 → 1.7.175

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 +11 -3
  2. package/package.json +1 -1
package/backend/data.js CHANGED
@@ -27,7 +27,6 @@ function validatePosition(position) {
27
27
  async function saveJobsDataToCMS() {
28
28
  const positions = await fetchPositionsFromSRAPI();
29
29
  // bulk insert to jobs collection without descriptions first
30
- console.log("positions@@@@@", positions);
31
30
  const jobsData = positions.content.map(position => {
32
31
  const basicJob = {
33
32
  _id: position.id,
@@ -40,7 +39,7 @@ async function saveJobsDataToCMS() {
40
39
  // language: position.language.label,
41
40
  // postingStatus: position.postingStatus,
42
41
  title: position.title || '',
43
- department: position.department?.label || '',
42
+ department: position.department?.label || 'Other',
44
43
  cityText: normalizeCityName(position.location?.city),
45
44
  location: position.location || {},
46
45
  country: position.location?.country || '',
@@ -59,7 +58,8 @@ async function saveJobsDataToCMS() {
59
58
  console.log(
60
59
  `Processing ${jobsData.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
61
60
  );
62
-
61
+ console.log("truncating jobs collection");
62
+ await wixData.truncate(COLLECTIONS.JOBS);
63
63
  await chunkedBulkOperation({
64
64
  items: jobsData,
65
65
  chunkSize,
@@ -315,6 +315,10 @@ async function createCollections() {
315
315
  }
316
316
 
317
317
  async function aggregateJobs() {
318
+ console.log("truncating cities collection");
319
+ await wixData.truncate(COLLECTIONS.CITIES);
320
+ console.log("truncating amount of jobs per department collection");
321
+ await wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT);
318
322
  console.log("Aggregating jobs");
319
323
  Promise.all([
320
324
  aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
@@ -324,6 +328,10 @@ async function aggregateJobs() {
324
328
  }
325
329
 
326
330
  async function referenceJobs() {
331
+ console.log("truncating cities collection");
332
+ await wixData.truncate(COLLECTIONS.CITIES);
333
+ console.log("truncating amount of jobs per department collection");
334
+ await wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT);
327
335
  console.log("Reference jobs");
328
336
  await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT })
329
337
  await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.173",
3
+ "version": "1.7.175",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {