sr-npm 1.7.560 → 1.7.561

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 -8
  2. package/package.json +1 -1
package/backend/data.js CHANGED
@@ -83,6 +83,7 @@ async function saveJobsDataToCMS() {
83
83
 
84
84
  // bulk insert to jobs collection without descriptions first
85
85
  const jobsData = sourcePositions.map(position => {
86
+ getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues,jobToCustomValues,customValuesToJobs);
86
87
  const basicJob = {
87
88
  _id: position.id,
88
89
  title: position.name || '',
@@ -105,9 +106,10 @@ async function saveJobsDataToCMS() {
105
106
  language: position.language?.label || '',
106
107
  brand: getBrand(position.customField),
107
108
  jobDescription: null, // Will be filled later
109
+ multiRefJobsCustomValues: jobToCustomValues[position.id],
108
110
  };
109
111
 
110
- getCustomFieldsAndValuesFromPosition(position,customFieldsLabels,customFieldsValues,jobToCustomValues,customValuesToJobs);
112
+
111
113
  return basicJob;
112
114
  });
113
115
 
@@ -115,7 +117,7 @@ async function saveJobsDataToCMS() {
115
117
  console.log("customFieldsValues: ", customFieldsValues);
116
118
  console.log("jobToCustomValues: ", jobToCustomValues);
117
119
  await populateCustomFieldsCollection(customFieldsLabels);
118
- await populateCustomValuesCollection(customFieldsValues);
120
+ await populateCustomValuesCollection(customFieldsValues,customValuesToJobs);
119
121
  // Sort jobs by title (ascending, case-insensitive, numeric-aware)
120
122
  jobsData.sort((a, b) => {
121
123
  const titleA = a.title || '';
@@ -151,10 +153,10 @@ async function saveJobsDataToCMS() {
151
153
  },
152
154
  });
153
155
 
154
- await insertValuesReference(jobToCustomValues);
155
- console.log("inserted values reference successfully");
156
- //await insertJobsReference(customValuesToJobs);
157
- console.log("inserted jobs reference successfully");
156
+ // await insertValuesReference(jobToCustomValues);
157
+ // console.log("inserted values reference successfully");
158
+ // //await insertJobsReference(customValuesToJobs);
159
+ // console.log("inserted jobs reference successfully");
158
160
 
159
161
  console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
160
162
  }
@@ -186,7 +188,7 @@ async function populateCustomFieldsCollection(customFields) {
186
188
  }
187
189
  await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
188
190
  }
189
- async function populateCustomValuesCollection(customFieldsValues) {
191
+ async function populateCustomValuesCollection(customFieldsValues,customValuesToJobs) {
190
192
  valuesToinsert=[]
191
193
  for (const fieldId of Object.keys(customFieldsValues)) {
192
194
  const valuesMap = customFieldsValues[fieldId] || {};
@@ -194,7 +196,8 @@ async function populateCustomValuesCollection(customFieldsValues) {
194
196
  valuesToinsert.push({
195
197
  _id: valueId,
196
198
  title: valuesMap[valueId],
197
- customField: fieldId, // reference to CustomFields collection (displays the label)
199
+ customField: fieldId,
200
+ multiRefJobsCustomValues: customValuesToJobs[valueId], // reference to CustomFields collection (displays the label)
198
201
  })
199
202
  }
200
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.560",
3
+ "version": "1.7.561",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {