keep old imported date when updating / remove unused calls
MODIFY
src/scheduler/tasks/SynchronizeTagsImportTask.ts
src/scheduler/tasks/SynchronizeTagsImportTask.ts
@@ -22,7 +22,6 @@ export default class SynchronizeTagsImportTask extends SchedulerTask {
const dbParams: DbParams = { limit: Constants.EXPORT_PAGE_SIZE, skip: 0 };
let importedTags = await TagStorage.getImportedTags(tenant.id, { withNoError: true }, dbParams);
while (importedTags && !Utils.isEmptyArray(importedTags.result)) {
- importedTags = await TagStorage.getImportedTags(tenant.id, { withNoError: true }, dbParams);
for (const importedTag of importedTags.result) {
const foundTag = await TagStorage.getTag(tenant.id, importedTag.id);
if (foundTag) {

MODIFY
src/storage/mongodb/TagStorage.ts
src/storage/mongodb/TagStorage.ts
@@ -44,7 +44,7 @@ export default class TagStorage {
const tagMDB = {
_id: importedTagToSave.id,
description: importedTagToSave.description,
- importedOn: new Date(),
+ importedOn: importedTagToSave.importedOn ? importedTagToSave.importedOn : new Date(),
importedBy: Utils.convertToObjectID(importedTagToSave.importedBy),
errorCode: importedTagToSave.errorCode,
errorDescription: importedTagToSave.errorDescription

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -282,7 +282,7 @@ export default class UserStorage {
name: importedUserToSave.name,
errorCode: importedUserToSave.errorCode,
errorDescription: importedUserToSave.errorDescription,
- importedOn: new Date(),
+ importedOn:importedUserToSave.importedOn ? importedUserToSave.importedOn : new Date(),
importedBy: Utils.convertToObjectID(importedUserToSave.importedBy)
};
await global.database.getCollection<any>(tenantID, 'usersImport').findOneAndUpdate(

keep old imported date when updating / remove unused calls