sr-npm 1.7.563 → 1.7.565
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/consts.js +6 -19
- package/backend/data.js +5 -45
- package/package.json +1 -1
package/backend/consts.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
const {saveJobsDataToCMS,
|
|
1
|
+
const {saveJobsDataToCMS,saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS,createCollections,aggregateJobs,referenceJobs,syncJobsFast} = require('./data')
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
const QUERY_MAX_LIMIT = 1000;
|
|
5
5
|
|
|
6
6
|
const TASKS_NAMES = {
|
|
7
7
|
SYNC_JOBS: 'syncJobsFromSRAPIToCMS',
|
|
8
|
-
SYNC_JOBS_SPLITTED: 'syncJobsFromSRAPIToCMSSplitted',
|
|
9
8
|
INSERT_JOBS_TO_CMS: 'insertJobsToCMS',
|
|
10
|
-
|
|
9
|
+
INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_REFERENCES_TO_CMS: 'insertJobsDescriptionsLocationApplyUrlReferencesToCMS',
|
|
11
10
|
AGGREGATE_JOBS_BY_FIELD_TO_CMS: 'aggregateJobsByFieldToCMS',
|
|
12
11
|
REFERENCE_JOBS: 'referenceJobs',
|
|
13
12
|
CREATE_COLLECTIONS: 'createCollections',
|
|
@@ -22,19 +21,7 @@ const TASKS = {
|
|
|
22
21
|
childTasks: [
|
|
23
22
|
{ name: TASKS_NAMES.CREATE_COLLECTIONS},
|
|
24
23
|
{ name: TASKS_NAMES.INSERT_JOBS_TO_CMS },
|
|
25
|
-
{ name: TASKS_NAMES.
|
|
26
|
-
{ name: TASKS_NAMES.AGGREGATE_JOBS_BY_FIELD_TO_CMS },
|
|
27
|
-
{name: TASKS_NAMES.REFERENCE_JOBS},
|
|
28
|
-
],
|
|
29
|
-
scheduleChildrenSequentially: true,
|
|
30
|
-
estimatedDurationSec: 60,
|
|
31
|
-
},
|
|
32
|
-
[TASKS_NAMES.SYNC_JOBS_SPLITTED]: {
|
|
33
|
-
name: TASKS_NAMES.SYNC_JOBS_SPLITTED,
|
|
34
|
-
childTasks: [
|
|
35
|
-
{ name: TASKS_NAMES.CREATE_COLLECTIONS},
|
|
36
|
-
{ name: TASKS_NAMES.INSERT_JOBS_TO_CMS },
|
|
37
|
-
{ name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_TO_CMS },
|
|
24
|
+
{ name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_REFERENCES_TO_CMS },
|
|
38
25
|
{ name: TASKS_NAMES.AGGREGATE_JOBS_BY_FIELD_TO_CMS },
|
|
39
26
|
{name: TASKS_NAMES.REFERENCE_JOBS},
|
|
40
27
|
],
|
|
@@ -55,10 +42,10 @@ const TASKS = {
|
|
|
55
42
|
shouldSkipCheck:()=>false,
|
|
56
43
|
estimatedDurationSec:20
|
|
57
44
|
},
|
|
58
|
-
[TASKS_NAMES.
|
|
59
|
-
name: TASKS_NAMES.
|
|
45
|
+
[TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_REFERENCES_TO_CMS]: {
|
|
46
|
+
name: TASKS_NAMES.INSERT_JOBS_DESCRIPTIONS_LOCATION_APPLY_URL_REFERENCES_TO_CMS,
|
|
60
47
|
getIdentifier:()=> "SHOULD_NEVER_SKIP",
|
|
61
|
-
process:
|
|
48
|
+
process:saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS,
|
|
62
49
|
shouldSkipCheck:()=>false,
|
|
63
50
|
estimatedDurationSec:20
|
|
64
51
|
},
|
package/backend/data.js
CHANGED
|
@@ -114,9 +114,6 @@ async function saveJobsDataToCMS() {
|
|
|
114
114
|
return basicJob;
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
console.log("customFieldsLabels: ", customFieldsLabels);
|
|
118
|
-
console.log("customFieldsValues: ", customFieldsValues);
|
|
119
|
-
console.log("jobToCustomValues: ", jobToCustomValues);
|
|
120
117
|
await populateCustomFieldsCollection(customFieldsLabels);
|
|
121
118
|
await populateCustomValuesCollection(customFieldsValues);
|
|
122
119
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
@@ -153,32 +150,14 @@ async function saveJobsDataToCMS() {
|
|
|
153
150
|
}
|
|
154
151
|
},
|
|
155
152
|
});
|
|
156
|
-
|
|
157
|
-
// await insertValuesReference(jobToCustomValues);
|
|
158
|
-
// console.log("inserted values reference successfully");
|
|
159
|
-
// //await insertJobsReference(customValuesToJobs);
|
|
160
|
-
// console.log("inserted jobs reference successfully");
|
|
161
|
-
|
|
162
153
|
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
|
|
163
154
|
}
|
|
164
155
|
|
|
165
156
|
async function insertValuesReference(jobId) {
|
|
166
157
|
await wixData.insertReference(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,jobId, jobToCustomValues[jobId]);
|
|
167
|
-
// console.log("inserting values reference");
|
|
168
|
-
// for (const jobId of Object.keys(jobToCustomValues)) {
|
|
169
|
-
// const items = jobToCustomValues[jobId];
|
|
170
|
-
// await wixData.insertReference(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,jobId, items);
|
|
171
|
-
// }
|
|
172
|
-
// console.log("inserted values reference successfully");
|
|
173
158
|
}
|
|
174
159
|
async function insertJobsReference(valueId) {
|
|
175
160
|
await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, customValuesToJobs[valueId]);
|
|
176
|
-
// console.log("inserting jobs reference");
|
|
177
|
-
// for (const valueId of Object.keys(customValuesToJobs)) {
|
|
178
|
-
// const items = customValuesToJobs[valueId];
|
|
179
|
-
// await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, items);
|
|
180
|
-
// }
|
|
181
|
-
// console.log("inserted jobs reference successfully");
|
|
182
161
|
}
|
|
183
162
|
|
|
184
163
|
async function populateCustomFieldsCollection(customFields) {
|
|
@@ -211,15 +190,12 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
|
|
|
211
190
|
try {
|
|
212
191
|
let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
213
192
|
let customValues=await getAllCustomValues();
|
|
214
|
-
console.log("customValues: ", customValues);
|
|
215
|
-
console.log("jobToCustomValues: ", jobToCustomValues);
|
|
216
|
-
console.log("customValuesToJobs: ", customValuesToJobs);
|
|
217
193
|
|
|
218
|
-
console.log("inserting jobs references");
|
|
194
|
+
console.log("inserting jobs references to custom values collection");
|
|
219
195
|
for (const value of customValues.items) {
|
|
220
196
|
await insertJobsReference(value._id);
|
|
221
197
|
}
|
|
222
|
-
console.log("inserted jobs references successfully");
|
|
198
|
+
console.log("inserted jobs references to custom values collection successfully");
|
|
223
199
|
|
|
224
200
|
|
|
225
201
|
let totalUpdated = 0;
|
|
@@ -468,23 +444,8 @@ async function syncJobsFast() {
|
|
|
468
444
|
await referenceJobs();
|
|
469
445
|
console.log("syncing jobs fast finished successfully");
|
|
470
446
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
await createCollections();
|
|
474
|
-
await clearCollections();
|
|
475
|
-
await fillSecretManagerMirror();
|
|
476
|
-
console.log("saving jobs data to CMS");
|
|
477
|
-
await saveJobsDataToCMS();
|
|
478
|
-
console.log("saved jobs data to CMS successfully");
|
|
479
|
-
await aggregateJobs();
|
|
480
|
-
await referenceJobs();
|
|
481
|
-
console.log("syncing jobs fast finished successfully");
|
|
482
|
-
}
|
|
483
|
-
async function syncJobsDescriptionsAndLocationApplyUrlFastSplitted() {
|
|
484
|
-
console.log("Syncing jobs descriptions and location apply url and values references");
|
|
485
|
-
await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS();
|
|
486
|
-
console.log("saved jobs descriptions and location apply url and values references successfully");
|
|
487
|
-
}
|
|
447
|
+
|
|
448
|
+
|
|
488
449
|
|
|
489
450
|
async function clearCollections() {
|
|
490
451
|
console.log("clearing collections");
|
|
@@ -543,8 +504,7 @@ module.exports = {
|
|
|
543
504
|
aggregateJobs,
|
|
544
505
|
createCollections,
|
|
545
506
|
saveJobsDataToCMS,
|
|
546
|
-
|
|
547
|
-
syncJobsDescriptionsAndLocationApplyUrlFastSplitted,
|
|
507
|
+
saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS,
|
|
548
508
|
aggregateJobsByFieldToCMS,
|
|
549
509
|
referenceJobsToField,
|
|
550
510
|
fillSecretManagerMirror,
|