sr-npm 1.7.639 → 1.7.640
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/collectionConsts.js +2 -0
- package/backend/data.js +3 -2
- package/package.json +1 -1
|
@@ -54,6 +54,7 @@ const CITIES_COLLECTION_FIELDS = {
|
|
|
54
54
|
LOCATION_ADDRESS: 'locationAddress',
|
|
55
55
|
COUNT: 'count',
|
|
56
56
|
COUNTRY: 'country',
|
|
57
|
+
JOB_IDS: 'jobIds',
|
|
57
58
|
}
|
|
58
59
|
const COLLECTIONS_FIELDS = {
|
|
59
60
|
AMOUNT_OF_JOBS_PER_DEPARTMENT: [
|
|
@@ -67,6 +68,7 @@ const COLLECTIONS_FIELDS = {
|
|
|
67
68
|
{key:'locationAddress', type: 'ADDRESS'},
|
|
68
69
|
{key:'count', type: 'NUMBER'},
|
|
69
70
|
{key:'country', type: 'TEXT'},
|
|
71
|
+
{key:'jobIds', type: 'ARRAY'},
|
|
70
72
|
],
|
|
71
73
|
JOBS: [
|
|
72
74
|
{key:'location', type: 'OBJECT'},
|
package/backend/data.js
CHANGED
|
@@ -9,6 +9,7 @@ const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
|
|
|
9
9
|
|
|
10
10
|
//let jobToCustomValues = {}
|
|
11
11
|
let customValuesToJobs = {}
|
|
12
|
+
let locationToJobs = {}
|
|
12
13
|
let siteconfig;
|
|
13
14
|
const EXCLUDED_CUSTOM_FIELDS = new Set(["Department"]);
|
|
14
15
|
|
|
@@ -64,7 +65,7 @@ function validateSingleDesiredBrand(desiredBrand) {
|
|
|
64
65
|
}
|
|
65
66
|
function getLocation(position,basicJob) {
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
|
|
68
69
|
|
|
69
70
|
}
|
|
70
71
|
function getEmploymentType(position,customFieldsValues) {
|
|
@@ -315,7 +316,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
315
316
|
console.log(`counting jobs per ${field}.`);
|
|
316
317
|
let results = await getAllPositions();
|
|
317
318
|
const { jobsPerField, cityLocations,citylocationAddress } = iterateOverAllJobs(results, field);
|
|
318
|
-
const toSave = prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress,
|
|
319
|
+
const toSave = prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress,locationToJobs);
|
|
319
320
|
if (toSave.length === 0) {
|
|
320
321
|
console.log('No jobs found.');
|
|
321
322
|
return { success: true, message: 'No jobs to save.' };
|