sr-npm 1.7.5 → 1.7.6
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 -4
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -9,7 +9,7 @@ function normalizeCityName(city) {
|
|
|
9
9
|
return city.normalize('NFD').replace(/\p{Diacritic}/gu, '').trim();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
async function saveDataJobsToCMS() {
|
|
13
13
|
const positions = await fetchPositionsFromSRAPI();
|
|
14
14
|
// bulk insert to jobs collection without descriptions first
|
|
15
15
|
const jobsData = positions.content.map((position) => {
|
|
@@ -55,7 +55,7 @@ export async function saveDataJobsToCMS() {
|
|
|
55
55
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
async function saveJobsDescriptionsToCMS() {
|
|
59
59
|
|
|
60
60
|
console.log('🚀 Starting job descriptions update process for ALL jobs using pagination...');
|
|
61
61
|
|
|
@@ -157,7 +157,7 @@ export async function saveJobsDescriptionsToCMS() {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
161
161
|
console.log(`counting jobs per ${field}.`);
|
|
162
162
|
let jobsPerField = {};
|
|
163
163
|
let cityLocations = {};
|
|
@@ -233,7 +233,7 @@ async function getJobsWithNoDescriptions() {
|
|
|
233
233
|
return jobswithoutdescriptionsQuery;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
async function referenceJobsToField({
|
|
237
237
|
referenceField, // e.g., "city" or "department"
|
|
238
238
|
sourceCollection, // e.g., "cities" or "departments"
|
|
239
239
|
jobField, // e.g., "cityText" or "department"
|
|
@@ -286,3 +286,10 @@ export async function referenceJobsToField({
|
|
|
286
286
|
|
|
287
287
|
return { success: true, updated: jobsToUpdate.length };
|
|
288
288
|
}
|
|
289
|
+
|
|
290
|
+
module.exports = {
|
|
291
|
+
saveDataJobsToCMS,
|
|
292
|
+
saveJobsDescriptionsToCMS,
|
|
293
|
+
aggregateJobsByFieldToCMS,
|
|
294
|
+
referenceJobsToField,
|
|
295
|
+
};
|