sr-npm 1.7.265 → 1.7.266
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
|
@@ -4,7 +4,7 @@ const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend
|
|
|
4
4
|
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS } = require('./collectionConsts');
|
|
5
5
|
const { chunkedBulkOperation, delay, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeCityName} = require('./utils');
|
|
6
6
|
const { getAllPositions } = require('./queries');
|
|
7
|
-
const
|
|
7
|
+
const secretsData = require('./secretsData');
|
|
8
8
|
|
|
9
9
|
function validatePosition(position) {
|
|
10
10
|
if (!position.id) {
|
|
@@ -293,7 +293,7 @@ async function createApiKeyCollectionAndFillIt() {
|
|
|
293
293
|
console.log("Creating ApiKey collection and filling it with the smart token");
|
|
294
294
|
await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY,null,'singleItem');
|
|
295
295
|
console.log("Getting the smart token");
|
|
296
|
-
const token = await getSmartToken();
|
|
296
|
+
const token = await secretsData.getSmartToken();
|
|
297
297
|
console.log("token is : ", token);
|
|
298
298
|
console.log("Inserting the smart token into the ApiKey collection");
|
|
299
299
|
await wixData.insert(COLLECTIONS.API_KEY, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { items: wixData } = require('@wix/data');
|
|
3
3
|
const { COLLECTIONS } = require('./collectionConsts');
|
|
4
|
-
const
|
|
4
|
+
const secretsData = require('./secretsData');
|
|
5
5
|
async function makeSmartRecruitersRequest(path,token) {
|
|
6
6
|
const baseUrl = 'https://api.smartrecruiters.com'; // PROD
|
|
7
7
|
// const baseUrl = 'https://bayank2.wixstudio.com/my-site-3//_functions'; // TEST
|
|
@@ -38,7 +38,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
38
38
|
let page = 0;
|
|
39
39
|
const MAX_PAGES = 30 // Safety limit to prevent infinite loops
|
|
40
40
|
const token = await getSmartTokenFromCMS();
|
|
41
|
-
const companyId=await getCompanyId();
|
|
41
|
+
const companyId = await secretsData.getCompanyId();
|
|
42
42
|
console.log('Starting to fetch all positions with pagination...');
|
|
43
43
|
let offset=0;
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
47
47
|
page++;
|
|
48
48
|
|
|
49
49
|
// Build the API path - first request has no page parameter, subsequent use nextPageId
|
|
50
|
-
let apiPath = `/v1/companies/${companyId}/postings?offset=${offset}`;
|
|
50
|
+
let apiPath = `/v1/companies/${companyId.value}/postings?offset=${offset}`;
|
|
51
51
|
if (nextPageId) {
|
|
52
52
|
apiPath += `&pageId=${nextPageId}`;
|
|
53
53
|
}
|