sr-npm 1.7.33 → 1.7.34
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 +9 -5
- package/backend/data.js +11 -6
- package/package.json +2 -2
- package/public/index.js +0 -0
|
@@ -11,21 +11,25 @@ const COLLECTIONS_FIELDS = {
|
|
|
11
11
|
{ key: 'count', type: 'NUMBER' },
|
|
12
12
|
],
|
|
13
13
|
CITIES: [
|
|
14
|
-
{
|
|
14
|
+
{key:'title', type: 'TEXT'},
|
|
15
|
+
{ key: 'regionCode', type: 'TEXT' },
|
|
15
16
|
{ key: 'city', type: 'TEXT' },
|
|
16
|
-
{key:'
|
|
17
|
+
{key:'location', type: 'OBJECT'},
|
|
17
18
|
{key:'count', type: 'NUMBER'},
|
|
18
19
|
{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'},
|
|
19
26
|
],
|
|
20
27
|
JOBS: [
|
|
21
28
|
{key:'location', type: 'OBJECT'},
|
|
22
|
-
{key:'title', type: 'TEXT'},
|
|
23
|
-
{key:'locationAddress', type: 'ADDRESS'},
|
|
24
29
|
{key:'postingStatus', type: 'TEXT'},
|
|
25
30
|
{key:'country', type: 'TEXT'},
|
|
26
31
|
{key:'department', type: 'TEXT'},
|
|
27
32
|
{key:'language', type: 'TEXT'},
|
|
28
|
-
{key:'remote', type: 'BOOLEAN'},
|
|
29
33
|
{key:'jobDescription', type: 'OBJECT'},
|
|
30
34
|
{key:'cityText', type: 'TEXT'},
|
|
31
35
|
{key:'departmentref', type: 'REFERENCE', typeMetadata: { reference: { referencedCollectionId: 'AmountOfJobsPerDepartment' } } },
|
package/backend/data.js
CHANGED
|
@@ -170,7 +170,6 @@ 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={}
|
|
174
173
|
let page = 1;
|
|
175
174
|
do {
|
|
176
175
|
console.log(`Page ${page}: ${results.items.length} jobs.`);
|
|
@@ -180,8 +179,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
180
179
|
throw new Error(`Job ${job._id} has no ${field} field`);
|
|
181
180
|
}
|
|
182
181
|
jobsPerField[job[field]] = (jobsPerField[job[field]] || 0) + 1;
|
|
183
|
-
if (field === 'cityText' && !
|
|
184
|
-
cityLocationAddress[job[field]] = job.locationAddress;
|
|
182
|
+
if (field === 'cityText' && !cityLocations[job[field]]) {
|
|
185
183
|
cityLocations[job[field]] = job.location;
|
|
186
184
|
}
|
|
187
185
|
}
|
|
@@ -193,7 +191,6 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
193
191
|
let toSave = [];
|
|
194
192
|
if (field === 'cityText') {
|
|
195
193
|
toSave = Object.entries(jobsPerField).map(([value, amount]) => {
|
|
196
|
-
const locAddress = cityLocationAddress[value] || {};
|
|
197
194
|
const loc = cityLocations[value] || {};
|
|
198
195
|
value = normalizeCityName(value);
|
|
199
196
|
|
|
@@ -201,9 +198,16 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
201
198
|
title: value,
|
|
202
199
|
_id: value.replace(/\s+/g, ''),
|
|
203
200
|
count: amount,
|
|
204
|
-
|
|
201
|
+
location: loc,
|
|
202
|
+
countryCode: loc.countryCode,
|
|
205
203
|
country: loc.country,
|
|
204
|
+
region: loc.region,
|
|
206
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
|
|
207
211
|
};
|
|
208
212
|
});
|
|
209
213
|
}
|
|
@@ -314,6 +318,7 @@ function fetchJobLocation(jobDetails) {
|
|
|
314
318
|
}
|
|
315
319
|
|
|
316
320
|
|
|
321
|
+
|
|
317
322
|
function getSmartToken() {
|
|
318
323
|
const elevatedGetSecretValue = auth.elevate(secrets.getSecretValue);
|
|
319
324
|
return elevatedGetSecretValue("x-smarttoken")
|
|
@@ -328,7 +333,7 @@ function getSmartToken() {
|
|
|
328
333
|
|
|
329
334
|
async function createApiKeyCollectionAndFillIt() {
|
|
330
335
|
console.log("Creating ApiKey collection and filling it with the smart token");
|
|
331
|
-
await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY);
|
|
336
|
+
await createCollectionIfMissing(COLLECTIONS.API_KEY, COLLECTIONS_FIELDS.API_KEY,null,'singleItem');
|
|
332
337
|
console.log("Getting the smart token");
|
|
333
338
|
const token = await getSmartToken();
|
|
334
339
|
console.log("token is : ", token);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sr-npm",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/psdevteamenterprise/sr-npm#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@hisense-staging/velo-npm": "1.7.
|
|
20
|
+
"@hisense-staging/velo-npm": "1.7.250",
|
|
21
21
|
"@wix/data": "^1.0.211",
|
|
22
22
|
"@wix/essentials": "^0.1.24",
|
|
23
23
|
"@wix/secrets": "1.0.53"
|
package/public/index.js
DELETED
|
File without changes
|