sr-npm 1.7.803 → 1.7.804

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.
@@ -22,7 +22,7 @@ async function getPositionWithMultiRefField(jobId)
22
22
  {
23
23
  return wixData
24
24
  .queryReferenced(COLLECTIONS.JOBS,jobId,JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
25
- .then(result => result.items[0]);
25
+ .then(result => result.items);
26
26
  }
27
27
 
28
28
  module.exports = { getAllPositions, getPositionsByField, getPositionWithMultiRefField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.803",
3
+ "version": "1.7.804",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,11 +1,15 @@
1
1
  const { query } = require("wix-location-frontend");
2
2
  const { getPositionWithMultiRefField } = require('../backend/queries');
3
+ const { COLLECTIONS,JOBS_COLLECTION_FIELDS } = require('../backend/collectionConsts');
4
+ const { items: wixData } = require('@wix/data');
3
5
  const {
4
6
  htmlToText,
5
7
  appendQueryParams
6
8
  } = require('../public/utils');
7
9
 
8
-
10
+ let categoryValueId;
11
+
12
+
9
13
  async function positionPageOnReady(_$w) {
10
14
 
11
15
  await bind(_$w);
@@ -13,13 +17,26 @@ const {
13
17
 
14
18
  }
15
19
 
20
+ async function getCategoryValueId(customFields) {
21
+ const categoryCustomField=await wixData.query(COLLECTIONS.CUSTOM_FIELDS).eq('title',"Category").find();
22
+ for(const field of customFields) {
23
+ if(field.customField===categoryCustomField._id) {
24
+ categoryValueId=field._id;
25
+ return;
26
+ }
27
+ }
28
+ }
29
+
30
+
16
31
  async function bind(_$w) {
17
32
  _$w('#datasetJobsItem').onReady(async () => {
18
33
 
19
34
  const item = await _$w('#datasetJobsItem').getCurrentItem();
20
- console.log("item@@$@$@$#$@: ", item);
21
35
  const multiRefField=await getPositionWithMultiRefField(item._id);
36
+ await getCategoryValueId(multiRefField);
22
37
  console.log("multiRefField@@$@$@$#$@: ", multiRefField);
38
+ console.log("categoryValueId@@$@$@$#$@: ", categoryValueId);
39
+
23
40
  handleReferFriendButton(_$w,item);
24
41
 
25
42
  handleApplyButton(_$w,item);
@@ -46,6 +63,8 @@ const {
46
63
 
47
64
  if(_$w('#relatedJobsRepNoDepartment')) // when there is no department, we filter based on category
48
65
  {
66
+ const relatedJobs=await getRelatedJobs();
67
+ console.log("relatedJobs@@$@$@$$%%%%%%%%%%#$@: ", relatedJobs);
49
68
  _$w('#relatedJobsRepNoDepartment').onItemReady(($item, itemData) => {
50
69
  $item('#relatedJobsItem').text = itemData.title;
51
70
  });
@@ -66,6 +85,12 @@ const {
66
85
  _$w('#applyButton').link=url; //so it can be clicked
67
86
  }
68
87
 
88
+ async function getRelatedJobs() {
89
+ const relatedJobs=await wixData.query(COLLECTIONS.JOBS).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES).hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,categoryValueId).find();
90
+ console.log("relatedJobs@@$@$@$#$@: ", relatedJobs);
91
+ return relatedJobs.items;
92
+ }
93
+
69
94
  module.exports = {
70
95
  positionPageOnReady,
71
96
  };