sr-npm 1.7.518 → 1.7.519
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
CHANGED
|
@@ -28,7 +28,6 @@ function validatePosition(position) {
|
|
|
28
28
|
|
|
29
29
|
async function filterBasedOnBrand(positions) {
|
|
30
30
|
try{
|
|
31
|
-
|
|
32
31
|
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
33
32
|
validateSingleDesiredBrand(desiredBrand);
|
|
34
33
|
console.log("filtering positions based on brand: ", desiredBrand);
|
|
@@ -53,10 +52,19 @@ function validateSingleDesiredBrand(desiredBrand) {
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
function addCustomFieldsToJob(basicJob, position) {
|
|
56
|
+
const customFieldsArray = Array.isArray(position?.customField) ? position.customField : [];
|
|
57
|
+
for (const field of customFieldsArray) {
|
|
58
|
+
const label = field.fieldLabel;
|
|
59
|
+
const key = normalizeString(label);
|
|
60
|
+
const value = field.valueLabel
|
|
61
|
+
basicJob[key] = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
async function saveJobsDataToCMS() {
|
|
57
66
|
const positions = await fetchPositionsFromSRAPI();
|
|
58
67
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
59
|
-
|
|
60
68
|
// bulk insert to jobs collection without descriptions first
|
|
61
69
|
const jobsData = sourcePositions.map(position => {
|
|
62
70
|
const basicJob = {
|
|
@@ -79,9 +87,11 @@ async function saveJobsDataToCMS() {
|
|
|
79
87
|
country: position.location?.country || '',
|
|
80
88
|
remote: position.location?.remote || false,
|
|
81
89
|
language: position.language?.label || '',
|
|
82
|
-
brand: getBrand(position.customField),
|
|
90
|
+
//brand: getBrand(position.customField),
|
|
83
91
|
jobDescription: null, // Will be filled later
|
|
84
92
|
};
|
|
93
|
+
addCustomFieldsToJob(basicJob,position)
|
|
94
|
+
console.log("basicJob: ", basicJob);
|
|
85
95
|
return basicJob;
|
|
86
96
|
});
|
|
87
97
|
|
|
@@ -354,18 +364,18 @@ async function referenceJobs() {
|
|
|
354
364
|
|
|
355
365
|
async function syncJobsFast() {
|
|
356
366
|
console.log("Syncing jobs fast");
|
|
357
|
-
await createCollections();
|
|
358
|
-
await clearCollections();
|
|
359
|
-
await fillSecretManagerMirror();
|
|
367
|
+
// await createCollections();
|
|
368
|
+
// await clearCollections();
|
|
369
|
+
// await fillSecretManagerMirror();
|
|
360
370
|
console.log("saving jobs data to CMS");
|
|
361
371
|
await saveJobsDataToCMS();
|
|
362
372
|
console.log("saved jobs data to CMS successfully");
|
|
363
|
-
console.log("saving jobs descriptions and location apply url to CMS");
|
|
364
|
-
await saveJobsDescriptionsAndLocationApplyUrlToCMS();
|
|
365
|
-
console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
366
|
-
await aggregateJobs();
|
|
367
|
-
await referenceJobs();
|
|
368
|
-
console.log("syncing jobs fast finished successfully");
|
|
373
|
+
// console.log("saving jobs descriptions and location apply url to CMS");
|
|
374
|
+
// await saveJobsDescriptionsAndLocationApplyUrlToCMS();
|
|
375
|
+
// console.log("saved jobs descriptions and location apply url to CMS successfully");
|
|
376
|
+
// await aggregateJobs();
|
|
377
|
+
// await referenceJobs();
|
|
378
|
+
// console.log("syncing jobs fast finished successfully");
|
|
369
379
|
}
|
|
370
380
|
|
|
371
381
|
async function clearCollections() {
|
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -3,8 +3,7 @@ const {wixData} = require('wix-data');
|
|
|
3
3
|
const { window } = require('@wix/site-window');
|
|
4
4
|
const { query,queryParams,onChange} = require("wix-location-frontend");
|
|
5
5
|
const { location } = require("@wix/site-location");
|
|
6
|
-
const { COLLECTIONS
|
|
7
|
-
const { getTokenFromCMS } = require('../backend/secretsData');
|
|
6
|
+
const { COLLECTIONS } = require('../backend/collectionConsts');
|
|
8
7
|
|
|
9
8
|
const {
|
|
10
9
|
debounce,
|
|
@@ -496,23 +495,13 @@ async function updateMapMarkers(_$w){
|
|
|
496
495
|
|
|
497
496
|
}
|
|
498
497
|
|
|
499
|
-
async function handleBrandDropdown(_$w)
|
|
500
|
-
const brands
|
|
501
|
-
|
|
502
|
-
try {
|
|
503
|
-
disableMultiBrand = await getTokenFromCMS(TOKEN_NAME.DISABLE_MULTI_BRAND);
|
|
504
|
-
} catch (e) {
|
|
505
|
-
if (e.message !== "[getTokenFromCMS], No disableMultiBrand found") throw e;
|
|
506
|
-
console.log("disableMultiBrand token wasn't found");
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
console.log("disableMultiBrand: ", disableMultiBrand);
|
|
510
|
-
if (brands.items.length > 1 && disableMultiBrand !== 'true') {
|
|
498
|
+
async function handleBrandDropdown(_$w){
|
|
499
|
+
const brands=await wixData.query(COLLECTIONS.BRANDS).find();
|
|
500
|
+
if(brands.items.length>1){
|
|
511
501
|
console.log("showing brand dropdown");
|
|
512
502
|
_$w('#dropdownBrand').show();
|
|
513
503
|
}
|
|
514
504
|
}
|
|
515
|
-
|
|
516
505
|
module.exports = {
|
|
517
506
|
careersPageOnReady,
|
|
518
507
|
};
|