sr-npm 1.7.476 → 1.7.478

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
@@ -7,8 +7,7 @@ const { getAllPositions } = require('./queries');
7
7
  const { getCompanyId, getSmartToken } = require('./secretsData');
8
8
 
9
9
  function getBrand(customField) {
10
- const brand = customField.find(field => field.fieldLabel === 'Brands')?.valueLabel;
11
- return brand ? normalizeString(brand) : '';
10
+ return customField.find(field => field.fieldLabel === 'Brands')?.valueLabel;
12
11
  }
13
12
 
14
13
  function validatePosition(position) {
@@ -35,7 +34,7 @@ async function saveJobsDataToCMS() {
35
34
  _id: position.id,
36
35
  title: position.name || '',
37
36
  department: position.department?.label || 'Other',
38
- cityText: normalizeString(position.location?.city).trim(),
37
+ cityText: normalizeString(position.location?.city),
39
38
  location: position.location && Object.keys(position.location).length > 0
40
39
  ? position.location
41
40
  : {
@@ -310,7 +309,8 @@ async function aggregateJobs() {
310
309
  console.log("Aggregating jobs");
311
310
  await Promise.all([
312
311
  aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT }),
313
- aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES })
312
+ aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
313
+ aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.BRAND, collection: COLLECTIONS.BRANDS })
314
314
  ]);
315
315
  console.log("finished aggregating jobs");
316
316
  }
package/backend/utils.js CHANGED
@@ -35,7 +35,7 @@ function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddre
35
35
  return Object.entries(jobsPerField).map(([value, amount]) => {
36
36
  const loc = cityLocations[value] || {};
37
37
  const locAddress = citylocationAddress[value] || {};
38
- value = normalizeString(value).trim();
38
+ value = normalizeString(value);
39
39
  return {
40
40
  title: value,
41
41
  _id: value.replace(/\s+/g, ''),
@@ -61,6 +61,7 @@ function normalizeString(str) {
61
61
  .normalize('NFD')
62
62
  .replace(/\p{Diacritic}/gu, '')
63
63
  .replace(/[^A-Za-z0-9-]/g, '')
64
+ .trim();
64
65
  }
65
66
 
66
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.476",
3
+ "version": "1.7.478",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {