sr-npm 1.7.120 → 1.7.121
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/consts.js +62 -26
- package/backend/data.js +2 -34
- package/backend/fetchPositionsFromSRAPI.js +1 -1
- package/package.json +1 -1
- package/pages/careersPage.js +3 -1
- package/pages/homePage.js +3 -0
package/backend/consts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {saveJobsDataToCMS,saveJobsDescriptionsAndLocationApplyUrlToCMS,aggregateJobsByFieldToCMS,referenceJobsToField,createApiKeyCollectionAndFillIt
|
|
1
|
+
const {saveJobsDataToCMS,saveJobsDescriptionsAndLocationApplyUrlToCMS,aggregateJobsByFieldToCMS,referenceJobsToField,createApiKeyCollectionAndFillIt} = require('./data');
|
|
2
2
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
3
3
|
const { COLLECTIONS, COLLECTIONS_FIELDS, JOBS_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
4
4
|
|
|
@@ -8,9 +8,13 @@ const TASKS_NAMES = {
|
|
|
8
8
|
SYNC_JOBS: 'syncJobsFromSRAPIToCMS',
|
|
9
9
|
INSERT_JOBS_TO_CMS: 'insertJobsToCMS',
|
|
10
10
|
INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS: 'insertJobsDescriptionsLocationApplyUrlToCMS',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
FILL_JOBS_PER_CITY_COLLECTION: 'fillJobsPerCityCollection',
|
|
12
|
+
FILL_JOBS_PER_DEPARTMENT_COLLECTION: 'fillJobsPerDepartmentCollection',
|
|
13
|
+
REFERENCE_JOBS_TO_LOCATIONS: 'referenceJobsToLocations',
|
|
14
|
+
REFERENCE_JOBS_TO_DEPARTMENT: 'referenceJobsToDepartment',
|
|
15
|
+
CREATE_JOBS_COLLECTION: 'createJobsCollection',
|
|
16
|
+
CREATE_CITIES_COLLECTION: 'createCitiesCollection',
|
|
17
|
+
CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION: 'createAmountOfJobsPerDepartmentCollection',
|
|
14
18
|
CREATE_API_KEY_COLLECTION_AND_FILL_IT: 'createApiKeyCollectionAndFillIt',
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -19,21 +23,39 @@ const TASKS = {
|
|
|
19
23
|
[TASKS_NAMES.SYNC_JOBS]: {
|
|
20
24
|
name: TASKS_NAMES.SYNC_JOBS,
|
|
21
25
|
childTasks: [
|
|
22
|
-
{ name: TASKS_NAMES.
|
|
26
|
+
{ name: TASKS_NAMES.CREATE_JOBS_COLLECTION },
|
|
27
|
+
{ name: TASKS_NAMES.CREATE_CITIES_COLLECTION },
|
|
28
|
+
{name: TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION},
|
|
23
29
|
{ name: TASKS_NAMES.INSERT_JOBS_TO_CMS },
|
|
24
30
|
{ name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS },
|
|
25
|
-
{ name: TASKS_NAMES.
|
|
26
|
-
{name: TASKS_NAMES.
|
|
31
|
+
{ name: TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION },
|
|
32
|
+
{ name: TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION },
|
|
33
|
+
{ name: TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS },
|
|
34
|
+
{ name: TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT },
|
|
27
35
|
],
|
|
28
36
|
scheduleChildrenSequentially: true,
|
|
29
|
-
estimatedDurationSec:
|
|
37
|
+
estimatedDurationSec: 30,
|
|
30
38
|
},
|
|
31
|
-
[TASKS_NAMES.
|
|
32
|
-
name: TASKS_NAMES.
|
|
39
|
+
[TASKS_NAMES.CREATE_JOBS_COLLECTION]: {
|
|
40
|
+
name: TASKS_NAMES.CREATE_JOBS_COLLECTION,
|
|
33
41
|
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
34
|
-
process:
|
|
42
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.JOBS, COLLECTIONS_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
35
43
|
shouldSkipCheck:()=>false,
|
|
36
|
-
estimatedDurationSec:
|
|
44
|
+
estimatedDurationSec:3
|
|
45
|
+
},
|
|
46
|
+
[TASKS_NAMES.CREATE_CITIES_COLLECTION]: {
|
|
47
|
+
name: TASKS_NAMES.CREATE_CITIES_COLLECTION,
|
|
48
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
49
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
50
|
+
shouldSkipCheck:()=>false,
|
|
51
|
+
estimatedDurationSec:3
|
|
52
|
+
},
|
|
53
|
+
[TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION]: {
|
|
54
|
+
name: TASKS_NAMES.CREATE_AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION,
|
|
55
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
56
|
+
process:()=>createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
57
|
+
shouldSkipCheck:()=>false,
|
|
58
|
+
estimatedDurationSec:3
|
|
37
59
|
},
|
|
38
60
|
[TASKS_NAMES.INSERT_JOBS_TO_CMS]: {
|
|
39
61
|
name: TASKS_NAMES.INSERT_JOBS_TO_CMS,
|
|
@@ -49,20 +71,34 @@ const TASKS = {
|
|
|
49
71
|
shouldSkipCheck:()=>false,
|
|
50
72
|
estimatedDurationSec:20
|
|
51
73
|
},
|
|
52
|
-
[TASKS_NAMES.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
[TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION]: {
|
|
75
|
+
name: TASKS_NAMES.FILL_JOBS_PER_CITY_COLLECTION,
|
|
76
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
77
|
+
process:()=>aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
78
|
+
shouldSkipCheck:()=>false,
|
|
79
|
+
estimatedDurationSec:3
|
|
80
|
+
},
|
|
81
|
+
[TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION]: {
|
|
82
|
+
name: TASKS_NAMES.FILL_JOBS_PER_DEPARTMENT_COLLECTION,
|
|
83
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
84
|
+
process:()=>aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT }),
|
|
85
|
+
shouldSkipCheck:()=>false,
|
|
86
|
+
estimatedDurationSec:3
|
|
87
|
+
},
|
|
88
|
+
[TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS]: {
|
|
89
|
+
name: TASKS_NAMES.REFERENCE_JOBS_TO_LOCATIONS,
|
|
90
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
91
|
+
process:()=>referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
|
|
92
|
+
shouldSkipCheck:()=>false,
|
|
93
|
+
estimatedDurationSec:3
|
|
94
|
+
},
|
|
95
|
+
[TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT]: {
|
|
96
|
+
name: TASKS_NAMES.REFERENCE_JOBS_TO_DEPARTMENT,
|
|
97
|
+
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
98
|
+
process:()=>referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT }),
|
|
99
|
+
shouldSkipCheck:()=>false,
|
|
100
|
+
estimatedDurationSec:3
|
|
101
|
+
},
|
|
66
102
|
[TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT]: {
|
|
67
103
|
name: TASKS_NAMES.CREATE_API_KEY_COLLECTION_AND_FILL_IT,
|
|
68
104
|
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
package/backend/data.js
CHANGED
|
@@ -18,7 +18,7 @@ function validatePosition(position) {
|
|
|
18
18
|
if (!position.department || !position.department.label) {
|
|
19
19
|
throw new Error('Position department is required and must have a label');
|
|
20
20
|
}
|
|
21
|
-
if (!position.location || !position.location.city ||
|
|
21
|
+
if (!position.location || !position.location.city || typeof position.location.remote !== 'boolean') {
|
|
22
22
|
throw new Error('Position location is required and must have a city and remote');
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -43,7 +43,6 @@ async function saveJobsDataToCMS() {
|
|
|
43
43
|
postingStatus: position.postingStatus,
|
|
44
44
|
jobDescription: null, // Will be filled later
|
|
45
45
|
};
|
|
46
|
-
console.log("basicJob", basicJob);
|
|
47
46
|
return basicJob;
|
|
48
47
|
});
|
|
49
48
|
console.log("jobsData@@@@@@@", jobsData);
|
|
@@ -134,10 +133,6 @@ async function saveJobsDescriptionsAndLocationApplyUrlToCMS() {
|
|
|
134
133
|
console.log(
|
|
135
134
|
` API chunk ${chunkNumber} completed: ${chunkSuccesses} success, ${chunkFailures} failed`
|
|
136
135
|
);
|
|
137
|
-
if (chunkNumber * API_CHUNK_SIZE < jobsWithNoDescriptions.items.length) {
|
|
138
|
-
console.log(' Waiting 2 seconds before next API chunk...');
|
|
139
|
-
await delay(2000);
|
|
140
|
-
}
|
|
141
136
|
},
|
|
142
137
|
});
|
|
143
138
|
|
|
@@ -162,6 +157,7 @@ async function saveJobsDescriptionsAndLocationApplyUrlToCMS() {
|
|
|
162
157
|
}
|
|
163
158
|
}
|
|
164
159
|
|
|
160
|
+
|
|
165
161
|
function iterateOverAllJobs(results, field) {
|
|
166
162
|
const jobsPerField = {};
|
|
167
163
|
const cityLocations = {};
|
|
@@ -303,36 +299,8 @@ async function createApiKeyCollectionAndFillIt() {
|
|
|
303
299
|
console.log("Smart token inserted into the ApiKey collection");
|
|
304
300
|
}
|
|
305
301
|
|
|
306
|
-
async function createCollections() {
|
|
307
|
-
console.log("Creating collections");
|
|
308
|
-
Promise.all(
|
|
309
|
-
[createCollectionIfMissing(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
310
|
-
createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
311
|
-
createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT)
|
|
312
|
-
]);
|
|
313
|
-
console.log("finished creating Collections");
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
async function aggregateJobs() {
|
|
317
|
-
console.log("Aggregating jobs");
|
|
318
|
-
Promise.all([
|
|
319
|
-
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
320
|
-
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT })
|
|
321
|
-
]);
|
|
322
|
-
console.log("finished aggregating jobs");
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
async function referenceJobs() {
|
|
326
|
-
console.log("Reference jobs");
|
|
327
|
-
await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.DEPARTMENT_REF, sourceCollection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, jobField: JOBS_COLLECTION_FIELDS.DEPARTMENT })
|
|
328
|
-
await referenceJobsToField({ referenceField: JOBS_COLLECTION_FIELDS.CITY, sourceCollection: COLLECTIONS.CITIES, jobField: JOBS_COLLECTION_FIELDS.CITY_TEXT }),
|
|
329
|
-
console.log("finished referencing jobs");
|
|
330
|
-
}
|
|
331
302
|
|
|
332
303
|
module.exports = {
|
|
333
|
-
referenceJobs,
|
|
334
|
-
aggregateJobs,
|
|
335
|
-
createCollections,
|
|
336
304
|
saveJobsDataToCMS,
|
|
337
305
|
saveJobsDescriptionsAndLocationApplyUrlToCMS,
|
|
338
306
|
aggregateJobsByFieldToCMS,
|
|
@@ -3,7 +3,7 @@ const { items: wixData } = require('@wix/data');
|
|
|
3
3
|
const { COLLECTIONS } = require('./collectionConsts');
|
|
4
4
|
async function makeSmartRecruitersRequest(path,token) {
|
|
5
5
|
const baseUrl = 'https://api.smartrecruiters.com'; // PROD
|
|
6
|
-
|
|
6
|
+
// const baseUrl = 'https://bayank2.wixstudio.com/my-site-3//_functions'; // TEST
|
|
7
7
|
const fullUrl = `${baseUrl}${path}`;
|
|
8
8
|
|
|
9
9
|
//console.log(`Making request to: ${fullUrl}`);
|
package/package.json
CHANGED
package/pages/careersPage.js
CHANGED
|
@@ -17,9 +17,11 @@ const {
|
|
|
17
17
|
let queryKeyWordVar;
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
async function careersPageOnReady(_$w,thisObject,queryPage,queryKeyWord) {
|
|
20
|
+
async function careersPageOnReady(_$w,thisObject,queryPage,queryKeyWord,query) {
|
|
21
21
|
queryPageVar=queryPage;
|
|
22
22
|
queryKeyWordVar=queryKeyWord;
|
|
23
|
+
console.log("query", query);
|
|
24
|
+
console.log("query.department", query.department);
|
|
23
25
|
thisObjectVar=thisObject;
|
|
24
26
|
allJobs=await getAllPositions();
|
|
25
27
|
await handleUrlParams(_$w);
|
package/pages/homePage.js
CHANGED
|
@@ -15,6 +15,9 @@ async function homePageOnReady(_$w,thisObject) {
|
|
|
15
15
|
function bind(_$w) {
|
|
16
16
|
_$w('#teamRepeater').onItemReady(($item, itemData) => {
|
|
17
17
|
$item('#teamButton').label = `View ${itemData.count} Open Positions`;
|
|
18
|
+
$item('#teamButton').onClick(()=>{
|
|
19
|
+
location.to(`/positions?department=${itemData._id}`);
|
|
20
|
+
});
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
_$w('#citiesDataset').onReady(async () => {
|