sr-npm 1.7.495 → 1.7.497
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 +11 -0
- package/package.json +1 -1
- package/pages/positionPage.js +1 -0
package/backend/data.js
CHANGED
|
@@ -28,7 +28,9 @@ function validatePosition(position) {
|
|
|
28
28
|
|
|
29
29
|
async function filterBasedOnBrand(positions) {
|
|
30
30
|
try{
|
|
31
|
+
|
|
31
32
|
const desiredBrand = await getTokenFromCMS(TOKEN_NAME.DESIRED_BRAND);
|
|
33
|
+
validateSingleDesiredBrand(desiredBrand);
|
|
32
34
|
console.log("filtering positions based on brand: ", desiredBrand);
|
|
33
35
|
return positions.content.filter(position => {
|
|
34
36
|
const brand = getBrand(position.customField);
|
|
@@ -36,11 +38,20 @@ async function filterBasedOnBrand(positions) {
|
|
|
36
38
|
return brand === desiredBrand;
|
|
37
39
|
});
|
|
38
40
|
} catch (error) {
|
|
41
|
+
if(error.message === "Desired brand must be a single brand"){
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
39
44
|
console.warn("Error with filtering based on brand:", error);
|
|
40
45
|
return positions.content;
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
function validateSingleDesiredBrand(desiredBrand) {
|
|
50
|
+
if(typeof desiredBrand !== 'string' || desiredBrand.includes("[") || desiredBrand.includes("]") || desiredBrand.includes(",")){
|
|
51
|
+
throw new Error("Desired brand must be a single brand");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
async function saveJobsDataToCMS() {
|
|
45
56
|
const positions = await fetchPositionsFromSRAPI();
|
|
46
57
|
const sourcePositions = await filterBasedOnBrand(positions);
|
package/package.json
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
_$w('#datasetJobsItem').onReady(async () => {
|
|
12
12
|
|
|
13
13
|
const item = await _$w('#datasetJobsItem').getCurrentItem();
|
|
14
|
+
console.log("item is FSFD: ", item);
|
|
14
15
|
|
|
15
16
|
_$w('#companyDescriptionText').text = htmlToText(item.jobDescription.companyDescription.text);
|
|
16
17
|
_$w('#responsibilitiesText').text = htmlToText(item.jobDescription.jobDescription.text);
|