sr-npm 1.7.412 → 1.7.414
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
CHANGED
|
@@ -293,7 +293,8 @@ async function createCollections() {
|
|
|
293
293
|
await Promise.all(
|
|
294
294
|
[createCollectionIfMissing(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.JOBS,{ insert: 'ADMIN', update: 'ADMIN', remove: 'ADMIN', read: 'ANYONE' }),
|
|
295
295
|
createCollectionIfMissing(COLLECTIONS.CITIES, COLLECTIONS_FIELDS.CITIES),
|
|
296
|
-
createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT)
|
|
296
|
+
createCollectionIfMissing(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT, COLLECTIONS_FIELDS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
297
|
+
createCollectionIfMissing(COLLECTIONS.SECRET_MANAGER_MIRROR, COLLECTIONS_FIELDS.SECRET_MANAGER_MIRROR)
|
|
297
298
|
]);
|
|
298
299
|
console.log("finished creating Collections");
|
|
299
300
|
}
|
|
@@ -318,9 +319,10 @@ async function syncJobsFast() {
|
|
|
318
319
|
console.log("Syncing jobs fast");
|
|
319
320
|
//database
|
|
320
321
|
|
|
321
|
-
|
|
322
|
+
|
|
322
323
|
await createCollections();
|
|
323
324
|
await clearCollections();
|
|
325
|
+
await fillSecretManagerMirror();
|
|
324
326
|
console.log("saving jobs data to CMS");
|
|
325
327
|
await saveJobsDataToCMS();
|
|
326
328
|
console.log("saved jobs data to CMS successfully");
|
|
@@ -337,7 +339,8 @@ async function clearCollections() {
|
|
|
337
339
|
await Promise.all([
|
|
338
340
|
wixData.truncate(COLLECTIONS.CITIES),
|
|
339
341
|
wixData.truncate(COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT),
|
|
340
|
-
wixData.truncate(COLLECTIONS.JOBS)
|
|
342
|
+
wixData.truncate(COLLECTIONS.JOBS),
|
|
343
|
+
wixData.truncate(COLLECTIONS.SECRET_MANAGER_MIRROR)
|
|
341
344
|
]);
|
|
342
345
|
console.log("cleared collections successfully");
|
|
343
346
|
}
|
|
@@ -356,9 +359,7 @@ async function markTemplateAsInternal() {
|
|
|
356
359
|
});
|
|
357
360
|
}
|
|
358
361
|
|
|
359
|
-
async function
|
|
360
|
-
console.log("Creating SecretManagerMirror collection and filling it");
|
|
361
|
-
await createCollectionIfMissing(COLLECTIONS.SECRET_MANAGER_MIRROR, COLLECTIONS_FIELDS.SECRET_MANAGER_MIRROR);
|
|
362
|
+
async function fillSecretManagerMirror() {
|
|
362
363
|
console.log("Getting the company ID ");
|
|
363
364
|
const companyId = await getCompanyId();
|
|
364
365
|
console.log("companyId is : ", companyId);
|
|
@@ -389,7 +390,7 @@ module.exports = {
|
|
|
389
390
|
saveJobsDescriptionsAndLocationApplyUrlToCMS,
|
|
390
391
|
aggregateJobsByFieldToCMS,
|
|
391
392
|
referenceJobsToField,
|
|
392
|
-
|
|
393
|
+
fillSecretManagerMirror,
|
|
393
394
|
markTemplateAsExternal,
|
|
394
395
|
markTemplateAsInternal,
|
|
395
396
|
};
|
|
@@ -107,7 +107,7 @@ async function fetchJobDescription(jobId) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
async function getCompanyIdFromCMS() {
|
|
110
|
-
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).
|
|
110
|
+
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName','companyId').find();
|
|
111
111
|
if (result.items.length > 0) {
|
|
112
112
|
return result.items[0].tokenValue;
|
|
113
113
|
} else {
|
|
@@ -116,7 +116,7 @@ async function getCompanyIdFromCMS() {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
async function getSmartTokenFromCMS() {
|
|
119
|
-
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).
|
|
119
|
+
const result = await wixData.query(COLLECTIONS.SECRET_MANAGER_MIRROR).eq('tokenName','x-smarttoken').find();
|
|
120
120
|
if (result.items.length > 0) {
|
|
121
121
|
return result.items[0].tokenValue;
|
|
122
122
|
} else {
|
|
@@ -124,7 +124,6 @@ async function getSmartTokenFromCMS() {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
async function getTemplateTypeFromCMS() {
|
|
127
|
-
console.log("COLLECTIONS.TEMPLATE_TYPE is ",COLLECTIONS.TEMPLATE_TYPE)
|
|
128
127
|
const result = await wixData.query(COLLECTIONS.TEMPLATE_TYPE).limit(1).find();
|
|
129
128
|
if (result.items.length > 0) {
|
|
130
129
|
return result.items[0].templateType;
|