sr-npm 1.7.209 → 1.7.210
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 -13
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -300,7 +300,7 @@ async function createApiKeyCollectionAndFillIt() {
|
|
|
300
300
|
|
|
301
301
|
async function createCollections() {
|
|
302
302
|
console.log("Creating collections");
|
|
303
|
-
Promise.all(
|
|
303
|
+
await Promise.all(
|
|
304
304
|
[createCollectionIfMissing(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
305
305
|
createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
306
306
|
createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT)
|
|
@@ -309,24 +309,20 @@ async function createCollections() {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
async function aggregateJobs() {
|
|
312
|
-
console.log("truncating cities collection");
|
|
313
|
-
//await wixData.truncate(COLLECTIONS.CITIES);
|
|
314
|
-
console.log("truncating amount of jobs per department collection");
|
|
315
|
-
//await wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT);
|
|
316
312
|
console.log("Aggregating jobs");
|
|
317
|
-
await
|
|
318
|
-
|
|
313
|
+
await Promise.all([
|
|
314
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT }),
|
|
315
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES })
|
|
316
|
+
]);
|
|
319
317
|
console.log("finished aggregating jobs");
|
|
320
318
|
}
|
|
321
319
|
|
|
322
320
|
async function referenceJobs() {
|
|
323
|
-
console.log("truncating cities collection");
|
|
324
|
-
//await wixData.truncate(COLLECTIONS.CITIES);
|
|
325
|
-
console.log("truncating amount of jobs per department collection");
|
|
326
|
-
//await wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT);
|
|
327
321
|
console.log("Reference jobs");
|
|
328
|
-
await
|
|
329
|
-
|
|
322
|
+
await Promise.all([
|
|
323
|
+
referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT }),
|
|
324
|
+
referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
|
|
325
|
+
]);
|
|
330
326
|
console.log("finished referencing jobs");
|
|
331
327
|
}
|
|
332
328
|
|