sr-npm 1.7.406 → 1.7.408

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 CHANGED
@@ -65,8 +65,8 @@ const TASKS = {
65
65
  },
66
66
  [TASKS_NAMES.SYNC_JOBS_FAST]: {
67
67
  name: TASKS_NAMES.SYNC_JOBS_FAST,
68
- getIdentifier:task=>task.data,
69
- process:task=>syncJobsFast(task),
68
+ getIdentifier:task=>task.data.templateType,
69
+ process:templateType=>syncJobsFast(templateType),
70
70
  shouldSkipCheck:()=>false,
71
71
  estimatedDurationSec:60
72
72
  }
package/backend/data.js CHANGED
@@ -359,9 +359,7 @@ async function referenceJobs() {
359
359
  console.log("finished referencing jobs");
360
360
  }
361
361
 
362
- async function syncJobsFast(templateType='something') {
363
- console.log("templateType is : ", templateType);
364
-
362
+ async function syncJobsFast(templateType) {
365
363
  console.log("Syncing jobs fast");
366
364
  await createCompanyIdCollectionAndFillIt();
367
365
  if(templateType==='INTERNAL')
@@ -34,9 +34,7 @@ async function fetchPositionsFromSRAPI() {
34
34
  let totalFound = 0;
35
35
  let page = 0;
36
36
  const MAX_PAGES = 30 // Safety limit to prevent infinite loops
37
- const companyId = await getCompanyIdFromCMS();
38
- const templateType = await getTemplateTypeFromCMS();
39
- const smartToken = templateType==='INTERNAL' ? await getSmartTokenFromCMS():undefined;
37
+ const {companyId,templateType,smartToken} = await getApiKeysFromCMS();
40
38
  console.log('Starting to fetch all positions with pagination...');
41
39
  let offset=0;
42
40
 
@@ -98,8 +96,8 @@ async function fetchPositionsFromSRAPI() {
98
96
  }
99
97
 
100
98
  async function fetchJobDescription(jobId) {
101
- const companyId = await getCompanyIdFromCMS();
102
- return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`);
99
+ const {companyId,smartToken} = await getApiKeysFromCMS();
100
+ return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,smartToken);
103
101
  }
104
102
 
105
103
  async function getCompanyIdFromCMS() {
@@ -129,6 +127,12 @@ async function getTemplateTypeFromCMS() {
129
127
  }
130
128
  }
131
129
 
130
+ async function getApiKeys() {
131
+ const companyId = await getCompanyIdFromCMS();
132
+ const templateType = await getTemplateTypeFromCMS();
133
+ const smartToken = templateType==='INTERNAL' ? await getSmartTokenFromCMS():undefined;
134
+ return {companyId,templateType,smartToken};
135
+ }
132
136
 
133
137
  module.exports = {
134
138
  fetchPositionsFromSRAPI,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.406",
3
+ "version": "1.7.408",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {