sr-npm 1.7.550 → 1.7.552
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 +8 -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 || '';
|
|
@@ -162,27 +162,28 @@ async function insertValuesReference(jobToCustomValues) {
|
|
|
162
162
|
await wixData.insertReference(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,jobId, items);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
165
|
+
async function insertJobsReference(jobToCustomValues) {
|
|
166
166
|
for (const jobId of Object.keys(jobToCustomValues)) {
|
|
167
167
|
for (const valueId of jobToCustomValues[jobId]) {
|
|
168
168
|
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, jobId);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
function populateCustomFieldsCollection(customFields) {
|
|
174
|
+
async function populateCustomFieldsCollection(customFields) {
|
|
174
175
|
for(const ID of Object.keys(customFields)){
|
|
175
|
-
wixData.save(COLLECTIONS.CUSTOM_FIELDS, {
|
|
176
|
+
await wixData.save(COLLECTIONS.CUSTOM_FIELDS, {
|
|
176
177
|
title: customFields[ID],
|
|
177
178
|
_id: ID,
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
|
-
function populateCustomValuesCollection(customFieldsValues) {
|
|
182
|
+
async function populateCustomValuesCollection(customFieldsValues) {
|
|
182
183
|
for (const fieldId of Object.keys(customFieldsValues)) {
|
|
183
184
|
const valuesMap = customFieldsValues[fieldId] || {};
|
|
184
185
|
for (const valueId of Object.keys(valuesMap)) {
|
|
185
|
-
wixData.save(COLLECTIONS.CUSTOM_VALUES, {
|
|
186
|
+
await wixData.save(COLLECTIONS.CUSTOM_VALUES, {
|
|
186
187
|
_id: valueId,
|
|
187
188
|
title: valuesMap[valueId],
|
|
188
189
|
customField: fieldId, // reference to CustomFields collection (displays the label)
|