sr-npm 1.7.363 → 1.7.364
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
|
@@ -340,7 +340,7 @@ async function referenceJobs() {
|
|
|
340
340
|
|
|
341
341
|
async function syncJobsFast() {
|
|
342
342
|
console.log("Syncing jobs fast");
|
|
343
|
-
await createApiKeyCollectionAndFillIt();
|
|
343
|
+
//await createApiKeyCollectionAndFillIt();
|
|
344
344
|
await createCollections();
|
|
345
345
|
await clearCollections();
|
|
346
346
|
console.log("saving jobs data to CMS");
|
|
@@ -2,7 +2,7 @@ const { fetch } = require('wix-fetch');
|
|
|
2
2
|
const { items: wixData } = require('@wix/data');
|
|
3
3
|
const { COLLECTIONS } = require('./collectionConsts');
|
|
4
4
|
const secretsData = require('./secretsData');
|
|
5
|
-
async function makeSmartRecruitersRequest(path
|
|
5
|
+
async function makeSmartRecruitersRequest(path) {
|
|
6
6
|
const baseUrl = 'https://api.smartrecruiters.com';
|
|
7
7
|
const fullUrl = `${baseUrl}${path}`;
|
|
8
8
|
|
|
@@ -12,7 +12,6 @@ async function makeSmartRecruitersRequest(path,token) {
|
|
|
12
12
|
headers: {
|
|
13
13
|
'Accept-Language': 'en',
|
|
14
14
|
'accept': 'application/json',
|
|
15
|
-
'x-smarttoken': token,
|
|
16
15
|
'Cookie': 'AWSALB=GYltFw3fLKortMxHR5vIOT1CuUROyhWNIX/qL8ZnPl1/8mhOcnIsBKYslzmNJPEzSy/jvNbO+6tXpH8yqcpQJagYt57MhbKlLqTSzoNq1G/w7TjOxPGR3UTdXW0d; AWSALBCORS=GYltFw3fLKortMxHR5vIOT1CuUROyhWNIX/qL8ZnPl1/8mhOcnIsBKYslzmNJPEzSy/jvNbO+6tXpH8yqcpQJagYt57MhbKlLqTSzoNq1G/w7TjOxPGR3UTdXW0d'
|
|
17
16
|
}
|
|
18
17
|
});
|
|
@@ -34,7 +33,6 @@ async function fetchPositionsFromSRAPI() {
|
|
|
34
33
|
let totalFound = 0;
|
|
35
34
|
let page = 0;
|
|
36
35
|
const MAX_PAGES = 30 // Safety limit to prevent infinite loops
|
|
37
|
-
const token = await getSmartTokenFromCMS();
|
|
38
36
|
const companyId = await secretsData.getCompanyId();
|
|
39
37
|
console.log('Starting to fetch all positions with pagination...');
|
|
40
38
|
let offset=0;
|
|
@@ -47,7 +45,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
47
45
|
const apiPath = `/v1/companies/${companyId.value}/postings?offset=${offset}`;
|
|
48
46
|
|
|
49
47
|
console.log(`Fetching page ${page} with path: ${apiPath}`);
|
|
50
|
-
const response = await makeSmartRecruitersRequest(apiPath
|
|
48
|
+
const response = await makeSmartRecruitersRequest(apiPath);
|
|
51
49
|
|
|
52
50
|
// Add positions from this page to our collection
|
|
53
51
|
if (response.content && Array.isArray(response.content)) {
|
|
@@ -97,9 +95,8 @@ async function fetchPositionsFromSRAPI() {
|
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
async function fetchJobDescription(jobId) {
|
|
100
|
-
const token = await getSmartTokenFromCMS();
|
|
101
98
|
const companyId = await secretsData.getCompanyId();
|
|
102
|
-
return await makeSmartRecruitersRequest(`/v1/companies/${companyId.value}/postings/${jobId}
|
|
99
|
+
return await makeSmartRecruitersRequest(`/v1/companies/${companyId.value}/postings/${jobId}`);
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
async function getSmartTokenFromCMS() {
|