sr-npm 1.7.174 → 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.
- package/backend/data.js +10 -1
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -58,7 +58,8 @@ async function saveJobsDataToCMS() {
|
|
|
58
58
|
console.log(
|
|
59
59
|
`Processing ${jobsData.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
console.log("truncating jobs collection");
|
|
62
|
+
await wixData.truncate(COLLECTIONS.JOBS);
|
|
62
63
|
await chunkedBulkOperation({
|
|
63
64
|
items: jobsData,
|
|
64
65
|
chunkSize,
|
|
@@ -314,6 +315,10 @@ async function createCollections() {
|
|
|
314
315
|
}
|
|
315
316
|
|
|
316
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);
|
|
317
322
|
console.log("Aggregating jobs");
|
|
318
323
|
Promise.all([
|
|
319
324
|
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
@@ -323,6 +328,10 @@ async function aggregateJobs() {
|
|
|
323
328
|
}
|
|
324
329
|
|
|
325
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);
|
|
326
335
|
console.log("Reference jobs");
|
|
327
336
|
await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT })
|
|
328
337
|
await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
|