sr-npm 1.7.28 → 1.7.29

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.
@@ -11,25 +11,19 @@ const COLLECTIONS_FIELDS = {
11
11
  { key: 'count', type: 'NUMBER' },
12
12
  ],
13
13
  CITIES: [
14
- {key:'title', type: 'TEXT'},
15
- { key: 'regionCode', type: 'TEXT' },
16
14
  { key: 'city', type: 'TEXT' },
17
- {key:'location', type: 'OBJECT'},
15
+ {key:'locationAddress', type: 'ADDRESS'},
18
16
  {key:'count', type: 'NUMBER'},
19
17
  {key:'country', type: 'TEXT'},
20
- {key:'remote', type: 'TEXT'},
21
- {key:'countryCode', type: 'TEXT'},
22
- {key:'manual', type: 'TEXT'},
23
- {key:'region', type: 'TEXT'},
24
- {key:'latitude', type: 'NUMBER'},
25
- {key:'longitude', type: 'NUMBER'},
26
18
  ],
27
19
  JOBS: [
28
20
  {key:'location', type: 'OBJECT'},
21
+ {key:'locationAddress', type: 'ADDRESS'},
29
22
  {key:'postingStatus', type: 'TEXT'},
30
23
  {key:'country', type: 'TEXT'},
31
24
  {key:'department', type: 'TEXT'},
32
25
  {key:'language', type: 'TEXT'},
26
+ {key:'remote', type: 'BOOLEAN'},
33
27
  {key:'jobDescription', type: 'OBJECT'},
34
28
  {key:'cityText', type: 'TEXT'},
35
29
  {key:'departmentref', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: 'AmountOfJobsPerDepartment' } } },
package/backend/data.js CHANGED
@@ -170,6 +170,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
170
170
  let cityLocations = {};
171
171
  let query = wixData.query("Jobs").limit(1000);
172
172
  let results = await query.find();
173
+ const cityLocationAddress={}
173
174
  let page = 1;
174
175
  do {
175
176
  console.log(`Page ${page}: ${results.items.length} jobs.`);
@@ -179,7 +180,8 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
179
180
  throw new Error(`Job ${job._id} has no ${field} field`);
180
181
  }
181
182
  jobsPerField[job[field]] = (jobsPerField[job[field]] || 0) + 1;
182
- if (field === 'cityText' && !cityLocations[job[field]]) {
183
+ if (field === 'cityText' && !cityLocationAddress[job[field]] && cityLocations[job[field]]) {
184
+ cityLocationAddress[job[field]] = job.locationAddress;
183
185
  cityLocations[job[field]] = job.location;
184
186
  }
185
187
  }
@@ -191,23 +193,16 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
191
193
  let toSave = [];
192
194
  if (field === 'cityText') {
193
195
  toSave = Object.entries(jobsPerField).map(([value, amount]) => {
196
+ const locAddress = cityLocationAddress[value] || {};
194
197
  const loc = cityLocations[value] || {};
195
198
  value = normalizeCityName(value);
196
199
 
197
200
  return {
198
- title: value,
199
201
  _id: value.replace(/\s+/g, ''),
200
202
  count: amount,
201
- location: loc,
202
- countryCode: loc.countryCode,
203
+ locationAddress: locAddress,
203
204
  country: loc.country,
204
- region: loc.region,
205
205
  city: loc.city,
206
- manual: loc.manual.toString(),
207
- remote: loc.remote.toString(),
208
- regionCode: loc.regionCode,
209
- latitude: loc.latitude,
210
- longitude: loc.longitude
211
206
  };
212
207
  });
213
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.28",
3
+ "version": "1.7.29",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {