sr-npm 3.1.23 → 3.1.24
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 +11 -4
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -463,14 +463,18 @@ function fetchJobLocation(jobDetails) {
|
|
|
463
463
|
|
|
464
464
|
async function createCollections() {
|
|
465
465
|
console.log("Creating collections");
|
|
466
|
+
if(siteconfig===undefined) {
|
|
467
|
+
await getSiteConfig();
|
|
468
|
+
}
|
|
469
|
+
|
|
466
470
|
await Promise.all(
|
|
467
471
|
[createCollectionIfMissing(COLLECTIONS.JOBS, COLLECTIONS_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
468
472
|
createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
469
473
|
createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
470
474
|
createCollectionIfMissing(COLLECTIONS.SECRET_MANAGER_MIRROR, COLLECTIONS_FIELDS.SECRET_MANAGER_MIRROR),
|
|
471
475
|
createCollectionIfMissing(COLLECTIONS.BRANDS, COLLECTIONS_FIELDS.BRANDS),
|
|
472
|
-
createCollectionIfMissing(COLLECTIONS.CUSTOM_VALUES, COLLECTIONS_FIELDS.CUSTOM_VALUES),
|
|
473
|
-
createCollectionIfMissing(COLLECTIONS.CUSTOM_FIELDS, COLLECTIONS_FIELDS.CUSTOM_FIELDS)
|
|
476
|
+
siteconfig.customFields==="true" ? createCollectionIfMissing(COLLECTIONS.CUSTOM_VALUES, COLLECTIONS_FIELDS.CUSTOM_VALUES) : null,
|
|
477
|
+
siteconfig.customFields==="true" ? createCollectionIfMissing(COLLECTIONS.CUSTOM_FIELDS, COLLECTIONS_FIELDS.CUSTOM_FIELDS) : null
|
|
474
478
|
]);
|
|
475
479
|
console.log("finished creating Collections");
|
|
476
480
|
}
|
|
@@ -528,13 +532,16 @@ async function syncJobsFast() {
|
|
|
528
532
|
|
|
529
533
|
async function clearCollections() {
|
|
530
534
|
console.log("clearing collections");
|
|
535
|
+
if(siteconfig===undefined) {
|
|
536
|
+
await getSiteConfig();
|
|
537
|
+
}
|
|
531
538
|
await Promise.all([
|
|
532
539
|
wixData.truncate(COLLECTIONS.CITIES),
|
|
533
540
|
wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
534
541
|
wixData.truncate(COLLECTIONS.JOBS),
|
|
535
542
|
wixData.truncate(COLLECTIONS.BRANDS),
|
|
536
|
-
wixData.truncate(COLLECTIONS.CUSTOM_VALUES),
|
|
537
|
-
wixData.truncate(COLLECTIONS.CUSTOM_FIELDS),
|
|
543
|
+
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_VALUES) : null,
|
|
544
|
+
siteconfig.customFields==="true" ? wixData.truncate(COLLECTIONS.CUSTOM_FIELDS) : null,
|
|
538
545
|
]);
|
|
539
546
|
console.log("cleared collections successfully");
|
|
540
547
|
}
|