sr-npm 1.7.551 → 1.7.553
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 +9 -7
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -112,8 +112,8 @@ async function saveJobsDataToCMS() {
|
|
|
112
112
|
console.log("customFieldsLabels: ", customFieldsLabels);
|
|
113
113
|
console.log("customFieldsValues: ", customFieldsValues);
|
|
114
114
|
console.log("jobToCustomValues: ", jobToCustomValues);
|
|
115
|
-
populateCustomFieldsCollection(customFieldsLabels);
|
|
116
|
-
populateCustomValuesCollection(customFieldsValues);
|
|
115
|
+
await populateCustomFieldsCollection(customFieldsLabels);
|
|
116
|
+
await populateCustomValuesCollection(customFieldsValues);
|
|
117
117
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
118
118
|
jobsData.sort((a, b) => {
|
|
119
119
|
const titleA = a.title || '';
|
|
@@ -150,8 +150,9 @@ async function saveJobsDataToCMS() {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
await insertValuesReference(jobToCustomValues);
|
|
153
|
+
console.log("inserted values reference successfully");
|
|
153
154
|
await insertJobsReference(jobToCustomValues);
|
|
154
|
-
|
|
155
|
+
console.log("inserted jobs reference successfully");
|
|
155
156
|
|
|
156
157
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
|
|
157
158
|
}
|
|
@@ -168,21 +169,22 @@ async function insertJobsReference(jobToCustomValues) {
|
|
|
168
169
|
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, jobId);
|
|
169
170
|
}
|
|
170
171
|
}
|
|
172
|
+
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
function populateCustomFieldsCollection(customFields) {
|
|
175
|
+
async function populateCustomFieldsCollection(customFields) {
|
|
174
176
|
for(const ID of Object.keys(customFields)){
|
|
175
|
-
wixData.save(COLLECTIONS.CUSTOM_FIELDS, {
|
|
177
|
+
await wixData.save(COLLECTIONS.CUSTOM_FIELDS, {
|
|
176
178
|
title: customFields[ID],
|
|
177
179
|
_id: ID,
|
|
178
180
|
});
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
|
-
function populateCustomValuesCollection(customFieldsValues) {
|
|
183
|
+
async function populateCustomValuesCollection(customFieldsValues) {
|
|
182
184
|
for (const fieldId of Object.keys(customFieldsValues)) {
|
|
183
185
|
const valuesMap = customFieldsValues[fieldId] || {};
|
|
184
186
|
for (const valueId of Object.keys(valuesMap)) {
|
|
185
|
-
wixData.save(COLLECTIONS.CUSTOM_VALUES, {
|
|
187
|
+
await wixData.save(COLLECTIONS.CUSTOM_VALUES, {
|
|
186
188
|
_id: valueId,
|
|
187
189
|
title: valuesMap[valueId],
|
|
188
190
|
customField: fieldId, // reference to CustomFields collection (displays the label)
|