sr-npm 1.7.559 → 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 +19 -12
  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
  }
@@ -177,24 +179,29 @@ async function insertJobsReference(customValuesToJobs) {
177
179
  }
178
180
 
179
181
  async function populateCustomFieldsCollection(customFields) {
182
+ fieldstoinsert=[]
180
183
  for(const ID of Object.keys(customFields)){
181
- await wixData.save(COLLECTIONS.CUSTOM_FIELDS, {
184
+ fieldstoinsert.push({
182
185
  title: customFields[ID],
183
186
  _id: ID,
184
- });
187
+ })
185
188
  }
189
+ await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
186
190
  }
187
- async function populateCustomValuesCollection(customFieldsValues) {
191
+ async function populateCustomValuesCollection(customFieldsValues,customValuesToJobs) {
192
+ valuesToinsert=[]
188
193
  for (const fieldId of Object.keys(customFieldsValues)) {
189
194
  const valuesMap = customFieldsValues[fieldId] || {};
190
195
  for (const valueId of Object.keys(valuesMap)) {
191
- await wixData.save(COLLECTIONS.CUSTOM_VALUES, {
196
+ valuesToinsert.push({
192
197
  _id: valueId,
193
198
  title: valuesMap[valueId],
194
- customField: fieldId, // reference to CustomFields collection (displays the label)
195
- });
199
+ customField: fieldId,
200
+ multiRefJobsCustomValues: customValuesToJobs[valueId], // reference to CustomFields collection (displays the label)
201
+ })
196
202
  }
197
203
  }
204
+ await wixData.bulkSave(COLLECTIONS.CUSTOM_VALUES, valuesToinsert);
198
205
  }
199
206
  async function saveJobsDescriptionsAndLocationApplyUrlToCMS() {
200
207
  console.log('🚀 Starting job descriptions update process for ALL jobs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.559",
3
+ "version": "1.7.561",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {