@yrpri/api 9.0.139 → 9.0.141
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/agents/assistants/agentAssistant.js +4 -3
- package/agents/assistants/baseAssistant.js +72 -71
- package/agents/assistants/baseAssistantWithVoice.js +6 -5
- package/agents/assistants/modes/agentDirectConnection.js +8 -7
- package/agents/assistants/modes/agentSelectionMode.js +2 -1
- package/agents/assistants/modes/baseAssistantMode.js +3 -2
- package/agents/assistants/modes/tools/agentTools.js +11 -10
- package/agents/assistants/modes/tools/loginTools.js +7 -6
- package/agents/assistants/modes/tools/models/agents.js +6 -5
- package/agents/assistants/modes/tools/models/subscriptions.js +7 -6
- package/agents/assistants/modes/tools/navigationTools.js +7 -6
- package/agents/assistants/modes/tools/subscriptionTools.js +12 -11
- package/agents/assistants/modes/tools/workflowConverstationTools.js +7 -6
- package/agents/assistants/voiceAssistant.js +45 -44
- package/agents/controllers/agentProductController.js +8 -7
- package/agents/controllers/agentSubscriptionController.js +13 -12
- package/agents/controllers/assistantsController.js +45 -44
- package/agents/controllers/policySynthAgents.js +33 -32
- package/agents/managers/emailInvitesManager.js +4 -3
- package/agents/managers/newAiModelSetup.js +46 -45
- package/agents/managers/notificationAgentQueueManager.js +55 -54
- package/agents/managers/subscriptionManager.js +24 -23
- package/agents/models/agentProduct.js +2 -1
- package/agents/models/agentProductBoosterPurchase.js +2 -1
- package/agents/models/testData/createEvolyAgentProduct.js +7 -6
- package/agents/models/testData/old/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/models/testData/updateAgentWorkflowConfiguration.js +5 -4
- package/agents/tools/setTemplateWorkflowCommunityId.js +6 -5
- package/app.d.ts +2 -1
- package/app.js +60 -34
- package/authorization.cjs +4 -4
- package/controllers/allOurIdeas.js +45 -44
- package/controllers/groups.cjs +4 -9
- package/controllers/images.cjs +8 -8
- package/controllers/index.cjs +1 -1
- package/controllers/points.cjs +1 -1
- package/controllers/posts.cjs +3 -3
- package/deleteUnwantedDeclerations.cjs +6 -5
- package/models/community.cjs +1 -1
- package/models/domain.cjs +7 -7
- package/models/image.cjs +2 -2
- package/models/index.cjs +8 -4
- package/models/post.cjs +10 -10
- package/models/user.cjs +1 -1
- package/models/video.cjs +4 -4
- package/package.json +5 -5
- package/scripts/addRatingUsersToGroup.js +1 -1
- package/scripts/addUserToOrganization.js +8 -8
- package/scripts/agents/changeModelForWorkflowGroupTemplate.js +13 -12
- package/scripts/agents/generateAgentWorkflowTemplateFromAgentClass.js +5 -4
- package/scripts/analyseRatingsForCommunity.js +2 -2
- package/scripts/analyzeAndFixBrokenPointUsers.js +3 -3
- package/scripts/analyzeEndorsementsByCountry.js +7 -7
- package/scripts/analyzePostsForCommunity.js +1 -1
- package/scripts/bulkStatusUpdates/listUpdates.js +2 -2
- package/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +5 -5
- package/scripts/bulkStatusUpdates/performUpdate.js +9 -9
- package/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +12 -11
- package/scripts/bulkStatusUpdates/performUpdateForStatus.js +15 -15
- package/scripts/change/changeVideoAspectTo.js +3 -3
- package/scripts/change/setUseNewVersion.cjs +5 -4
- package/scripts/changeCommunityGroupcount.js +3 -3
- package/scripts/changeCommunityPostCount.js +3 -3
- package/scripts/changeGroupPostCount.js +3 -3
- package/scripts/changeLanguage.js +4 -4
- package/scripts/changeOfficalStatus.js +3 -3
- package/scripts/cleanups/deleteAnonNotifications.cjs +8 -7
- package/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +8 -8
- package/scripts/cleanups/deleteYearOldNotifications.cjs +6 -5
- package/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +5 -5
- package/scripts/clearAllEndorsementInGroup.js +5 -5
- package/scripts/cloning/clearUsersForCommunitiesFromUrl.js +3 -3
- package/scripts/cloning/cloneFromUrlScript.js +4 -4
- package/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +6 -6
- package/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithEverything.js +2 -2
- package/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +3 -3
- package/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +3 -3
- package/scripts/cloning/copyPostToGroupOld.js +12 -12
- package/scripts/cloning/copyPostVideosFromURL.js +3 -3
- package/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +2 -2
- package/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +7 -7
- package/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +6 -6
- package/scripts/cloning/setAdminsFromURL.js +5 -5
- package/scripts/cloning/setExternalIdsFromURL.js +3 -3
- package/scripts/countCommunity.js +11 -11
- package/scripts/countCommunityUsers.js +4 -4
- package/scripts/countDelayedNotifications.js +3 -3
- package/scripts/countGroup.js +11 -11
- package/scripts/countStuff.js +3 -3
- package/scripts/countUniqueVotersInAGroup.js +3 -3
- package/scripts/createInvitesAndShow.js +2 -2
- package/scripts/database/sync_database.js +2 -2
- package/scripts/database/sync_dev_database.js +3 -3
- package/scripts/debugNotifications.js +5 -5
- package/scripts/deleteAllNewsFeeds.js +2 -2
- package/scripts/deleteCategory.js +1 -1
- package/scripts/deleteOldAppActivities.js +5 -4
- package/scripts/deletePostContactDataForCommunity.js +5 -4
- package/scripts/destroy/destroy_all_but_one_domain.js +59 -59
- package/scripts/displayAuthorForPost.js +1 -1
- package/scripts/domains/createDomain.js +5 -4
- package/scripts/domains/importDomainsFromXls.js +7 -6
- package/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +2 -2
- package/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +9 -9
- package/scripts/exportAllStatusChanges.js +5 -5
- package/scripts/exportEndorsementsForCommunity.js +5 -5
- package/scripts/exportPointQualitiesForCommunity.js +5 -5
- package/scripts/exportPostsAndPointsForCommunity.js +9 -9
- package/scripts/exportPostsDataSetForDomain.js +12 -12
- package/scripts/exportPostsForGroup.js +7 -7
- package/scripts/exportRatingsForPost.js +2 -2
- package/scripts/exportUserEndorsementsWithUserAnalysis.js +6 -6
- package/scripts/exportUsersForCommunity.js +3 -3
- package/scripts/exportUsersForDomain.js +3 -3
- package/scripts/exportUsersForGroup.js +3 -3
- package/scripts/exports/ratingDistribution.js +6 -6
- package/scripts/exports/whoEndorsedWhatByCommunity.js +2 -2
- package/scripts/findUnusedClientImports.js +2 -2
- package/scripts/fixAllPostPointCounts.js +1 -1
- package/scripts/fixAnonNotificationsSettings.js +5 -5
- package/scripts/fixCountKopavogur.js +1 -1
- package/scripts/fixEndorsementsAfterCopyPostToGroup.js +10 -10
- package/scripts/fixExternalUserId.js +2 -2
- package/scripts/fixGroupAccess.js +3 -3
- package/scripts/fixGroupIdeasAndPointsCount.js +2 -2
- package/scripts/fixNotificationSettings.js +4 -4
- package/scripts/fixSurveyRadioBakedInSubCodes.js +6 -6
- package/scripts/fixWrongUserIdForStatusUpdates.js +6 -5
- package/scripts/gallery/exportGalleryData.js +2 -2
- package/scripts/gallery/importGalleryForCommunity.js +14 -14
- package/scripts/gallery/readJsonAndDownloadImagesVersion2.js +6 -6
- package/scripts/gallery/refreshAcApiPostIdsForCommunity.js +5 -5
- package/scripts/genderAnalysis.js +10 -10
- package/scripts/genderAnalysisByStatus.js +4 -4
- package/scripts/importAllLocalesFromLocalFolders.js +7 -7
- package/scripts/importDomain.js +131 -131
- package/scripts/keys/addOidcToDomain.cjs +10 -9
- package/scripts/landUseGame/export3Ddata.js +15 -15
- package/scripts/listLanguagesForGroup.js +6 -6
- package/scripts/loadTestCreateDummyContentForGroup.js +2 -2
- package/scripts/makeRecursiveMapData.js +4 -4
- package/scripts/mapping/community_map_csv.js +5 -5
- package/scripts/moveCommunityToDomain.js +3 -3
- package/scripts/moveGroupToCommunity.js +3 -3
- package/scripts/movePostToGroup.js +5 -5
- package/scripts/movePostsToGroupsRecountGroupFromUrl.js +6 -6
- package/scripts/oldMovePostToGroup.js +9 -9
- package/scripts/processCsvForPdfUrls.js +2 -2
- package/scripts/processCsvForTranslationAndToxicity.js +10 -10
- package/scripts/recount/recount_recursive_communities.js +6 -6
- package/scripts/recountALLCommunityGroupCounts.js +4 -4
- package/scripts/recountAll.js +3 -3
- package/scripts/recountCommunitesFromUrl.js +3 -3
- package/scripts/recountCommunity.js +2 -2
- package/scripts/recountGroup.js +5 -5
- package/scripts/recountGroupNoUserChange.js +5 -5
- package/scripts/resetAllEndorsementsForGroup.js +3 -3
- package/scripts/resetEnTranslationForGroup.js +5 -5
- package/scripts/setAdminOnAll.cjs +15 -14
- package/scripts/setDomainAdmin.cjs +7 -6
- package/scripts/setDomainLocales.js +2 -2
- package/scripts/setEarlQuestionIdOnGroup.cjs +5 -4
- package/scripts/setLanguageOnGroupCommunitesFromUrl.js +3 -3
- package/scripts/setMemberOfAll.js +14 -14
- package/scripts/setNewUserForContentOfCommunity.js +9 -9
- package/scripts/setOfficialStatusOnAllPostsForCommunity.js +1 -1
- package/scripts/setUserOnAll.js +14 -14
- package/scripts/showCategoryForGroup.js +1 -1
- package/scripts/showOldActivityTypes.js +3 -3
- package/scripts/showPostsMissingCategoryForGroup.js +2 -2
- package/scripts/showStatuses.js +4 -4
- package/scripts/showUniqueVotersInCommunity.js +4 -4
- package/scripts/showUserAgentsAndIpsForEmails.js +4 -4
- package/scripts/simpleExportForGroupsForCommunity.js +5 -5
- package/scripts/simpleExportForPointsForCommunity.js +5 -5
- package/scripts/simpleExportForPostsForCommunity.js +5 -5
- package/scripts/testForEndorsments.js +4 -4
- package/scripts/undeleteGroupAndAllContent.js +8 -8
- package/scripts/undeletePost.js +7 -7
- package/scripts/unlinkSsn.js +4 -4
- package/scripts/updateFromAlthingi.js +8 -8
- package/scripts/users/createUserAddDomain.js +6 -5
- package/scripts/users/importUsersForDomainsFromXls.js +4 -3
- package/scripts/users/listDomainUsersWithSsn.js +6 -5
- package/scripts/users/removeUserFromDomain.js +6 -5
- package/scripts/users/updatePasswordFromSsn.js +5 -4
- package/scripts/users/updateUserSsnFromEmail.js +5 -4
- package/services/controllers/activities.cjs +1 -1
- package/services/controllers/news_feeds.cjs +1 -1
- package/services/controllers/notifications.cjs +1 -1
- package/services/controllers/recommendations.cjs +1 -1
- package/services/engine/allOurIdeas/aiHelper.js +10 -9
- package/services/engine/analytics/export_anon_community_activities.js +3 -3
- package/services/engine/analytics/importer.js +10 -10
- package/services/engine/analytics/plausible/manager.cjs +4 -4
- package/services/engine/analytics/statsCalc.cjs +1 -1
- package/services/engine/analytics/utils.cjs +11 -10
- package/services/engine/marketing/campaign.cjs +1 -0
- package/services/engine/moderation/fraud/CreateFraudAuditReport.cjs +2 -1
- package/services/engine/moderation/fraud/FraudBase.cjs +3 -2
- package/services/engine/moderation/fraud/FraudDeleteBase.cjs +5 -4
- package/services/engine/moderation/fraud/FraudGetBase.cjs +2 -1
- package/services/engine/moderation/fraud/FraudGetEndorsements.cjs +2 -1
- package/services/engine/moderation/fraud/FraudGetPointQualities.cjs +2 -1
- package/services/engine/moderation/fraud/FraudGetPoints.cjs +2 -1
- package/services/engine/moderation/fraud/FraudGetPosts.cjs +2 -1
- package/services/engine/moderation/fraud/FraudGetRatings.cjs +2 -1
- package/services/engine/moderation/fraud/FraudScannerNotifier.cjs +10 -9
- package/services/engine/moderation/get_moderation_items.cjs +1 -1
- package/services/engine/moderation/image_labeling/ImageLabelingBase.cjs +1 -1
- package/services/engine/moderation/process_moderation_items.cjs +1 -1
- package/services/engine/moderation/toxicity_analysis.cjs +1 -1
- package/services/engine/news_feeds/generate_dynamically.cjs +1 -1
- package/services/engine/news_feeds/generate_from_notifications.cjs +1 -1
- package/services/engine/notifications/emails_utils.cjs +2 -2
- package/services/engine/notifications/generate_point_notifications.cjs +1 -1
- package/services/engine/notifications/generate_post_notifications.cjs +1 -1
- package/services/engine/notifications/process_delayed_notifications.cjs +38 -38
- package/services/engine/notifications/process_general_notifications.cjs +1 -0
- package/services/engine/old/exporters/categories_dataset.js +11 -11
- package/services/engine/old/exporters/sentiment_dataset.js +12 -12
- package/services/engine/recommendations/events_importer.cjs +5 -5
- package/services/engine/recommendations/events_manager.cjs +1 -1
- package/services/engine/reports/add_points_to_sheet.cjs +3 -2
- package/services/engine/reports/commonUtils.js +3 -2
- package/services/engine/reports/common_utils.cjs +8 -8
- package/services/engine/reports/docx_group_report.cjs +1 -1
- package/services/engine/reports/xlsAllOurIdeasExport.js +16 -15
- package/services/engine/reports/xls_community_users_report.cjs +2 -2
- package/services/engine/reports/xls_group_report.cjs +1 -1
- package/services/llms/baseChatBot.js +12 -11
- package/services/llms/imageGeneration/chatGptImageGenerator.js +3 -2
- package/services/llms/imageGeneration/collectionImageGenerator.js +7 -6
- package/services/llms/imageGeneration/dalleImageGenerator.js +6 -5
- package/services/llms/imageGeneration/fluxImageGenerator.js +5 -4
- package/services/llms/imageGeneration/imageProcessorService.js +2 -1
- package/services/llms/imageGeneration/imagenImageGenerator.js +8 -7
- package/services/llms/imageGeneration/s3Service.js +12 -11
- package/services/llms/llmTranslation.js +30 -29
- package/services/models/ac_activity.cjs +1 -1
- package/services/models/ac_notification.cjs +1 -1
- package/services/models/ac_translation_cache.cjs +11 -11
- package/services/scripts/analytics/setup_all_plausible_goals.cjs +3 -2
- package/services/scripts/fix_old_delayed_notifications.js +3 -3
- package/services/scripts/kue_status.js +11 -11
- package/services/scripts/kue_watch_stuck_jobs.js +6 -6
- package/services/scripts/translation_clear_language.js +21 -21
- package/services/scripts/translation_delete.js +4 -4
- package/services/scripts/translation_replace_text_from_url.js +4 -4
- package/services/scripts/translation_update.js +4 -4
- package/services/scripts/translations_list.js +5 -5
- package/services/utils/airbrake.cjs +2 -1
- package/services/utils/redisConnection.cjs +6 -5
- package/services/utils/translation_helpers.cjs +3 -2
- package/services/utils/updateAllLocalesFromEn.js +20 -19
- package/services/utils/updateLocaleFolders.js +7 -6
- package/services/workers/activity.cjs +1 -1
- package/services/workers/anonymizations.cjs +1 -1
- package/services/workers/bulk_status_update.cjs +2 -2
- package/services/workers/delayed_jobs.cjs +1 -1
- package/services/workers/deletions.cjs +1 -1
- package/services/workers/email.cjs +1 -1
- package/services/workers/fraud_management.cjs +3 -3
- package/services/workers/generativeAi.js +6 -5
- package/services/workers/main.cjs +1 -1
- package/services/workers/marketing.cjs +1 -1
- package/services/workers/moderation.cjs +1 -1
- package/services/workers/notification_delivery.cjs +1 -1
- package/services/workers/notification_news_feed.cjs +1 -1
- package/services/workers/queue.cjs +2 -2
- package/services/workers/recount.cjs +1 -1
- package/services/workers/reports.cjs +1 -1
- package/services/workers/similarities.cjs +4 -2
- package/services/workers/speech_to_text.cjs +1 -1
- package/utils/airbrake.cjs +2 -1
- package/utils/cjsCodeReview.js +7 -6
- package/utils/community_mapping_tools.cjs +3 -2
- package/utils/copy_utils.cjs +32 -31
- package/utils/export_utils.cjs +7 -7
- package/utils/generateDocumentation.js +10 -9
- package/utils/logger.cjs +2 -23
- package/utils/logger.d.cts +1 -1
- package/utils/loggerAirbrakeTransport.cjs +52 -0
- package/utils/loggerAirbrakeTransport.d.cts +15 -0
- package/utils/loggerAirbrakeTransportTs.d.ts +15 -0
- package/utils/loggerAirbrakeTransportTs.js +45 -0
- package/utils/loggerCore.cjs +29 -0
- package/utils/loggerCore.d.cts +2 -0
- package/utils/loggerCoreTs.d.ts +2 -0
- package/utils/loggerCoreTs.js +23 -0
- package/utils/loggerTs.d.ts +1 -2
- package/utils/loggerTs.js +2 -25
- package/utils/manifest_generator.cjs +1 -0
- package/utils/recount_utils.cjs +6 -5
- package/utils/seedModels.js +50 -49
- package/utils/sitemap_generator.cjs +4 -4
- package/utils/ypLanguages.js +2 -2
- package/webSockets.js +8 -7
- package/services/utils/logger.cjs +0 -25
- package/services/utils/logger.d.cts +0 -2
- package/src/agents/assistants/assistant.d.ts +0 -156
- package/src/controllers/audios.d.ts +0 -5
- package/src/controllers/categories.d.ts +0 -5
- package/src/controllers/communities.d.ts +0 -5
- package/src/controllers/domains.d.ts +0 -5
- package/src/controllers/groups.d.ts +0 -5
- package/src/controllers/images.d.ts +0 -5
- package/src/controllers/points.d.ts +0 -5
- package/src/controllers/posts.d.ts +0 -5
- package/src/controllers/ratings.d.ts +0 -5
- package/src/controllers/users.d.ts +0 -5
- package/src/controllers/videos.d.ts +0 -5
- package/src/models/index.d.ts +0 -84
- package/src/services/controllers/activities.d.ts +0 -5
- package/src/services/controllers/notifications.d.ts +0 -5
- package/src/utils/copy_utils.d.ts +0 -4
- package/src/utils/manifest_generator.d.ts +0 -18
|
@@ -24,15 +24,15 @@ const addUsers = (users) => {
|
|
|
24
24
|
const userIds = users.map(u => u.id);
|
|
25
25
|
userIdsToKeep = userIdsToKeep.concat(userIds);
|
|
26
26
|
userIdsToKeep = _.uniq(userIdsToKeep);
|
|
27
|
-
//
|
|
27
|
+
//log.info(userIdsToKeep.length);
|
|
28
28
|
};
|
|
29
29
|
const addUsersIds = (userIds) => {
|
|
30
30
|
if (userIds.indexOf(56884) > -1) {
|
|
31
|
-
|
|
31
|
+
log.info("adding 56884");
|
|
32
32
|
}
|
|
33
33
|
userIdsToKeep = userIdsToKeep.concat(userIds);
|
|
34
34
|
userIdsToKeep = _.uniq(userIdsToKeep);
|
|
35
|
-
//
|
|
35
|
+
//log.info(userIdsToKeep.length);
|
|
36
36
|
};
|
|
37
37
|
const addImages = (images) => {
|
|
38
38
|
const imageIds = images.map(i => i.id);
|
|
@@ -408,14 +408,14 @@ async function getActivities() {
|
|
|
408
408
|
async function setupIdsToKeep() {
|
|
409
409
|
return await new Promise(async (resolve, reject) => {
|
|
410
410
|
try {
|
|
411
|
-
|
|
411
|
+
log.info("Setup domain");
|
|
412
412
|
const domain = await getDomain();
|
|
413
413
|
addUsers(domain.DomainUsers);
|
|
414
414
|
addUsers(domain.DomainAdmins);
|
|
415
415
|
addImages(domain.DomainLogoImages);
|
|
416
416
|
addImages(domain.DomainHeaderImages);
|
|
417
417
|
addVideos(domain.DomainLogoVideos);
|
|
418
|
-
|
|
418
|
+
log.info("Setup community");
|
|
419
419
|
const communities = await getCommunities();
|
|
420
420
|
communityIdsToKeep = communities.map(c => c.id);
|
|
421
421
|
for (let i = 0; i < communities.length; i++) {
|
|
@@ -426,7 +426,7 @@ async function setupIdsToKeep() {
|
|
|
426
426
|
addImages(communities[i].CommunityHeaderImages);
|
|
427
427
|
addVideos(communities[i].CommunityLogoVideos);
|
|
428
428
|
}
|
|
429
|
-
|
|
429
|
+
log.info("Setup group");
|
|
430
430
|
const groups = await getGroups();
|
|
431
431
|
groupIdsToKeep = groups.map(c => c.id);
|
|
432
432
|
for (let i = 0; i < groups.length; i++) {
|
|
@@ -441,12 +441,12 @@ async function setupIdsToKeep() {
|
|
|
441
441
|
categoryIdsToKeep = categories.map(c => c.id);
|
|
442
442
|
const pages = await getPages();
|
|
443
443
|
pageIdsToKeep = pages.map(p => p.id);
|
|
444
|
-
|
|
444
|
+
log.info("Setup posts");
|
|
445
445
|
const posts = await getPosts();
|
|
446
446
|
postIdsToKeep = posts.map(p => p.id);
|
|
447
447
|
for (let i = 0; i < posts.length; i++) {
|
|
448
448
|
if (posts[i].user_id == null) {
|
|
449
|
-
|
|
449
|
+
log.error(`User id null for ${posts[i].id}`);
|
|
450
450
|
}
|
|
451
451
|
else {
|
|
452
452
|
addUsersIds([posts[i].user_id]);
|
|
@@ -456,7 +456,7 @@ async function setupIdsToKeep() {
|
|
|
456
456
|
addAudios(posts[i].PostAudios);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
|
|
459
|
+
log.info("Setup points");
|
|
460
460
|
const points = await getPoints();
|
|
461
461
|
pointIdsToKeep = points.map(p => p.id);
|
|
462
462
|
for (let i = 0; i < points.length; i++) {
|
|
@@ -476,14 +476,14 @@ async function setupIdsToKeep() {
|
|
|
476
476
|
}
|
|
477
477
|
const pointRevisions = await getPointRevisions();
|
|
478
478
|
pointRevisionIdsToKeep = pointRevisions.map(p => p.id);
|
|
479
|
-
|
|
479
|
+
log.info("Setup activities");
|
|
480
480
|
const activities = await getActivities();
|
|
481
481
|
activityIdsToKeep = activities.map(a => a.id);
|
|
482
482
|
for (let i = 0; i < activities.length; i++) {
|
|
483
483
|
if (activities[i].user_id)
|
|
484
484
|
addUsersIds([activities[i].user_id]);
|
|
485
485
|
else
|
|
486
|
-
|
|
486
|
+
log.warn(`No user_id for activity ${activities[i].id}`);
|
|
487
487
|
}
|
|
488
488
|
const users = await getUsers();
|
|
489
489
|
for (let i = 0; i < users.length; i++) {
|
|
@@ -503,7 +503,7 @@ async function setupIdsToKeep() {
|
|
|
503
503
|
}
|
|
504
504
|
async function deleteVideos() {
|
|
505
505
|
return await new Promise(async (resolve, reject) => {
|
|
506
|
-
|
|
506
|
+
log.info("Destroying videos images");
|
|
507
507
|
const videos = await models.Video.unscoped().findAll({
|
|
508
508
|
attributes: ['id'],
|
|
509
509
|
where: {
|
|
@@ -515,7 +515,7 @@ async function deleteVideos() {
|
|
|
515
515
|
for (let i = 0; i < videos.length; i++) {
|
|
516
516
|
await videos[i].setVideoImages([]);
|
|
517
517
|
}
|
|
518
|
-
|
|
518
|
+
log.info("Destroying videos");
|
|
519
519
|
await models.Video.unscoped().destroy({ where: {
|
|
520
520
|
id: {
|
|
521
521
|
[models.Sequelize.Op.notIn]: videoIdsToKeep
|
|
@@ -526,7 +526,7 @@ async function deleteVideos() {
|
|
|
526
526
|
}
|
|
527
527
|
async function deletePointAssociations() {
|
|
528
528
|
return await new Promise(async (resolve, reject) => {
|
|
529
|
-
|
|
529
|
+
log.info("Destroying PointAssociations ");
|
|
530
530
|
const points = await models.Point.unscoped().findAll({
|
|
531
531
|
attributes: ['id'],
|
|
532
532
|
where: {
|
|
@@ -544,7 +544,7 @@ async function deletePointAssociations() {
|
|
|
544
544
|
}
|
|
545
545
|
async function deletePostAssociations() {
|
|
546
546
|
return await new Promise(async (resolve, reject) => {
|
|
547
|
-
|
|
547
|
+
log.info("Destroying PostAssociations ");
|
|
548
548
|
const posts = await models.Post.unscoped().findAll({
|
|
549
549
|
attributes: ['id'],
|
|
550
550
|
where: {
|
|
@@ -564,7 +564,7 @@ async function deletePostAssociations() {
|
|
|
564
564
|
}
|
|
565
565
|
async function deleteUserAssociations() {
|
|
566
566
|
return await new Promise(async (resolve, reject) => {
|
|
567
|
-
|
|
567
|
+
log.info("Destroying UserAssociations ");
|
|
568
568
|
const users = await models.User.unscoped().findAll({
|
|
569
569
|
attributes: ['id'],
|
|
570
570
|
where: {
|
|
@@ -589,7 +589,7 @@ async function deleteUserAssociations() {
|
|
|
589
589
|
}
|
|
590
590
|
async function deleteGroupAssociations() {
|
|
591
591
|
return await new Promise(async (resolve, reject) => {
|
|
592
|
-
|
|
592
|
+
log.info("Destroying GroupAssociations ");
|
|
593
593
|
const groups = await models.Group.unscoped().findAll({
|
|
594
594
|
attributes: ['id'],
|
|
595
595
|
where: {
|
|
@@ -610,7 +610,7 @@ async function deleteGroupAssociations() {
|
|
|
610
610
|
}
|
|
611
611
|
async function deleteCommunityAssociations() {
|
|
612
612
|
return await new Promise(async (resolve, reject) => {
|
|
613
|
-
|
|
613
|
+
log.info("Destroying CommunityAssociations ");
|
|
614
614
|
const communities = await models.Community.unscoped().findAll({
|
|
615
615
|
attributes: ['id'],
|
|
616
616
|
where: {
|
|
@@ -631,7 +631,7 @@ async function deleteCommunityAssociations() {
|
|
|
631
631
|
}
|
|
632
632
|
async function deleteDomainAssociations() {
|
|
633
633
|
return await new Promise(async (resolve, reject) => {
|
|
634
|
-
|
|
634
|
+
log.info("Destroying DomainAssociations ");
|
|
635
635
|
const domains = await models.Domain.unscoped().findAll({
|
|
636
636
|
attributes: ['id'],
|
|
637
637
|
where: {
|
|
@@ -652,7 +652,7 @@ async function deleteDomainAssociations() {
|
|
|
652
652
|
}
|
|
653
653
|
async function deleteActivityAssociations() {
|
|
654
654
|
return await new Promise(async (resolve, reject) => {
|
|
655
|
-
|
|
655
|
+
log.info("Destroying ActivitiesAssociations ");
|
|
656
656
|
const activities = await models.AcActivity.unscoped().findAll({
|
|
657
657
|
attributes: ['id']
|
|
658
658
|
});
|
|
@@ -665,7 +665,7 @@ async function deleteActivityAssociations() {
|
|
|
665
665
|
}
|
|
666
666
|
async function deleteNotificationAssociations() {
|
|
667
667
|
return await new Promise(async (resolve, reject) => {
|
|
668
|
-
|
|
668
|
+
log.info("Destroying NoitficationAssociations ");
|
|
669
669
|
const notifications = await models.AcNotification.unscoped().findAll({
|
|
670
670
|
attributes: ['id'],
|
|
671
671
|
});
|
|
@@ -679,7 +679,7 @@ async function deleteNotificationAssociations() {
|
|
|
679
679
|
}
|
|
680
680
|
async function deleteImageAssociations() {
|
|
681
681
|
return await new Promise(async (resolve, reject) => {
|
|
682
|
-
|
|
682
|
+
log.info("Destroying ImageAssociations ");
|
|
683
683
|
const images = await models.Image.unscoped().findAll({
|
|
684
684
|
attributes: ['id'],
|
|
685
685
|
where: {
|
|
@@ -710,7 +710,7 @@ async function deleteInChunks(model, where) {
|
|
|
710
710
|
if (items.length > 0) {
|
|
711
711
|
const modelIds = items.map(n => { return n.id; });
|
|
712
712
|
offset += 2500;
|
|
713
|
-
|
|
713
|
+
log.info(`offset: ${offset}`);
|
|
714
714
|
const destroyResults = await model.unscoped().destroy({
|
|
715
715
|
where: {
|
|
716
716
|
id: {
|
|
@@ -747,117 +747,117 @@ async function deleteAll() {
|
|
|
747
747
|
//await deleteActivityAssociations();
|
|
748
748
|
//await deleteNotificationAssociations();
|
|
749
749
|
//await deleteImageAssociations();
|
|
750
|
-
|
|
750
|
+
log.info("Destroying points");
|
|
751
751
|
await deleteInChunks(models.Point.unscoped(), {
|
|
752
752
|
id: {
|
|
753
753
|
[models.Sequelize.Op.notIn]: pointIdsToKeep
|
|
754
754
|
}
|
|
755
755
|
});
|
|
756
|
-
|
|
756
|
+
log.info("Destroying point qualities");
|
|
757
757
|
await deleteInChunks(models.PointQuality.unscoped(), {
|
|
758
758
|
id: {
|
|
759
759
|
[models.Sequelize.Op.notIn]: qualityIdsToKeep
|
|
760
760
|
}
|
|
761
761
|
});
|
|
762
|
-
|
|
762
|
+
log.info("Destroying point revision");
|
|
763
763
|
await deleteInChunks(models.PointRevision.unscoped(), {
|
|
764
764
|
id: {
|
|
765
765
|
[models.Sequelize.Op.notIn]: pointRevisionIdsToKeep
|
|
766
766
|
}
|
|
767
767
|
});
|
|
768
|
-
|
|
768
|
+
log.info("Destroying post revision");
|
|
769
769
|
await deleteInChunks(models.PostRevision.unscoped(), {
|
|
770
770
|
post_id: null
|
|
771
771
|
});
|
|
772
|
-
|
|
772
|
+
log.info("Destroying temp data and not used 1");
|
|
773
773
|
//await models.AcNewsFeedItem.unscoped().destroy({ truncate: true });
|
|
774
|
-
|
|
774
|
+
log.info("Destroying temp data and not used 2");
|
|
775
775
|
//await models.AcNewsFeedProcessedRange.unscoped().destroy({ truncate: true });
|
|
776
|
-
|
|
776
|
+
log.info("Destroying temp data and not used 3");
|
|
777
777
|
//await models.AcDelayedNotification.unscoped().destroy({ truncate: true });
|
|
778
|
-
|
|
778
|
+
log.info("Destroying temp data and not used 4");
|
|
779
779
|
// You will need to temporarily disable some foreign key constraints
|
|
780
780
|
//await models.AcNotification.unscoped().destroy({ truncate: true });
|
|
781
|
-
|
|
781
|
+
log.info("Destroying temp data and not used 5");
|
|
782
782
|
// You will need to temporarily disable some foreign key constraints
|
|
783
783
|
//await models.AcActivity.unscoped().destroy({ truncate: true });
|
|
784
|
-
|
|
784
|
+
log.info("Destroying temp data and not used 6");
|
|
785
785
|
//await models.AcBackgroundJob.unscoped().destroy({ truncate: true });
|
|
786
|
-
|
|
786
|
+
log.info("Destroying temp data and not used 7");
|
|
787
787
|
//await models.AcClientActivity.unscoped().destroy({ truncate: true });
|
|
788
|
-
|
|
788
|
+
log.info("Destroying temp data and not used 8");
|
|
789
789
|
//await models.AcTranslationCache.unscoped().destroy({ truncate: true });
|
|
790
|
-
|
|
790
|
+
log.info("Destroying temp data and not used 9");
|
|
791
791
|
//await models.GeneralDataStore.unscoped().destroy({ truncate: true });
|
|
792
|
-
|
|
792
|
+
log.info("Destroying temp data and not used 10");
|
|
793
793
|
await deleteInChunks(models.Invite.unscoped(), {});
|
|
794
|
-
|
|
794
|
+
log.info("Destroying temp data and not used 11");
|
|
795
795
|
await deleteInChunks(models.PostStatusChange.unscoped(), {});
|
|
796
796
|
await deleteInChunks(models.BulkStatusUpdate.unscoped(), {});
|
|
797
|
-
|
|
797
|
+
log.info("Destroying temp data and not used 12");
|
|
798
798
|
//await deleteInChunks(models.PostRevision.unscoped(), {
|
|
799
799
|
//});
|
|
800
|
-
|
|
800
|
+
log.info("Destroying temp data and not used 13");
|
|
801
801
|
//await models.Rating.unscoped().destroy({ truncate: true });
|
|
802
|
-
|
|
802
|
+
log.info("Destroying temp data and not used 14");
|
|
803
803
|
await models.UserLegacyPassword.unscoped().destroy({ truncate: true });
|
|
804
|
-
|
|
805
|
-
|
|
804
|
+
log.info("Destroying temp data and not used 15");
|
|
805
|
+
log.info("Destroying posts");
|
|
806
806
|
await deleteInChunks(models.Post.unscoped(), {
|
|
807
807
|
id: {
|
|
808
808
|
[models.Sequelize.Op.notIn]: postIdsToKeep
|
|
809
809
|
}
|
|
810
810
|
});
|
|
811
|
-
|
|
811
|
+
log.info("Destroying endorsements");
|
|
812
812
|
await deleteInChunks(models.Endorsement.unscoped(), {
|
|
813
813
|
id: {
|
|
814
814
|
[models.Sequelize.Op.notIn]: endorsementIdsToKeep
|
|
815
815
|
}
|
|
816
816
|
});
|
|
817
|
-
|
|
817
|
+
log.info("Destroying pages");
|
|
818
818
|
await deleteInChunks(models.Page.unscoped(), {
|
|
819
819
|
id: {
|
|
820
820
|
[models.Sequelize.Op.notIn]: pageIdsToKeep
|
|
821
821
|
}
|
|
822
822
|
});
|
|
823
|
-
|
|
823
|
+
log.info("Destroying categories");
|
|
824
824
|
await deleteInChunks(models.Category.unscoped(), {
|
|
825
825
|
id: {
|
|
826
826
|
[models.Sequelize.Op.notIn]: categoryIdsToKeep
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
|
-
|
|
829
|
+
log.info("Destroying groups");
|
|
830
830
|
await deleteInChunks(models.Group.unscoped(), {
|
|
831
831
|
id: {
|
|
832
832
|
[models.Sequelize.Op.notIn]: groupIdsToKeep
|
|
833
833
|
}
|
|
834
834
|
});
|
|
835
|
-
|
|
835
|
+
log.info("Destroying communities");
|
|
836
836
|
await deleteInChunks(models.Community.unscoped(), {
|
|
837
837
|
id: {
|
|
838
838
|
[models.Sequelize.Op.notIn]: communityIdsToKeep
|
|
839
839
|
}
|
|
840
840
|
});
|
|
841
|
-
|
|
841
|
+
log.info("Destroying domains");
|
|
842
842
|
await deleteInChunks(models.Domain.unscoped(), {
|
|
843
843
|
id: {
|
|
844
844
|
[models.Sequelize.Op.notIn]: [domainIdToKeep]
|
|
845
845
|
}
|
|
846
846
|
});
|
|
847
847
|
await deleteVideos();
|
|
848
|
-
|
|
848
|
+
log.info("Destroying audios");
|
|
849
849
|
await deleteInChunks(models.Audio.unscoped(), {
|
|
850
850
|
id: {
|
|
851
851
|
[models.Sequelize.Op.notIn]: audioIdsToKeep
|
|
852
852
|
}
|
|
853
853
|
});
|
|
854
|
-
|
|
854
|
+
log.info("Destroying images");
|
|
855
855
|
await deleteInChunks(models.Image.unscoped(), {
|
|
856
856
|
id: {
|
|
857
857
|
[models.Sequelize.Op.notIn]: imageIdsToKeep
|
|
858
858
|
}
|
|
859
859
|
});
|
|
860
|
-
|
|
860
|
+
log.info("Destroying users");
|
|
861
861
|
let haveItemsToDelete = true;
|
|
862
862
|
let offset = 0;
|
|
863
863
|
let deletedItems = 0;
|
|
@@ -872,7 +872,7 @@ async function deleteAll() {
|
|
|
872
872
|
return userIdsToKeep.indexOf(uid) === -1;
|
|
873
873
|
});
|
|
874
874
|
if (userIdsToDelete.indexOf(56884) > -1) {
|
|
875
|
-
|
|
875
|
+
log.info("DELETING 56884");
|
|
876
876
|
}
|
|
877
877
|
if (userIdsToDelete.length > 0) {
|
|
878
878
|
deletedItems += userIdsToDelete.length;
|
|
@@ -884,7 +884,7 @@ async function deleteAll() {
|
|
|
884
884
|
}
|
|
885
885
|
});
|
|
886
886
|
offset += 2500;
|
|
887
|
-
|
|
887
|
+
log.info(offset);
|
|
888
888
|
}
|
|
889
889
|
else {
|
|
890
890
|
haveItemsToDelete = false;
|
|
@@ -910,7 +910,7 @@ async function copyVideosToMinio() {
|
|
|
910
910
|
for (let f = 0; f < formats.length; f++) {
|
|
911
911
|
const newUrl = await copyFileFromS3ToMinio("minio-video-public", formats[f]);
|
|
912
912
|
formats[f] = newUrl;
|
|
913
|
-
|
|
913
|
+
log.info(newUrl);
|
|
914
914
|
}
|
|
915
915
|
videos[i].formats = formats;
|
|
916
916
|
videos[i].changed('formats', true);
|
|
@@ -956,7 +956,7 @@ async function copyAudiosToMinio() {
|
|
|
956
956
|
for (let f = 0; f < formats.length; f++) {
|
|
957
957
|
const newUrl = await copyFileFromS3ToMinio("minio-audio-public", formats[f]);
|
|
958
958
|
formats[f] = newUrl;
|
|
959
|
-
|
|
959
|
+
log.info(`New ${newUrl}`);
|
|
960
960
|
}
|
|
961
961
|
audios[i].formats = formats;
|
|
962
962
|
audios[i].changed('formats', true);
|
|
@@ -999,7 +999,7 @@ async function copyFileFromS3ToMinio(bucket, url) {
|
|
|
999
999
|
stream.close(() => {
|
|
1000
1000
|
fs.mkdirSync(minioMetaDataFolderPath, { recursive: true });
|
|
1001
1001
|
fs.writeFileSync(`${minioMetaDataFolderPath}/fs.json`, fsFileContent);
|
|
1002
|
-
|
|
1002
|
+
log.info(`Copy completed for ${url}`);
|
|
1003
1003
|
const newUrlPath = `${minioBaseUrlPath}/${bucket}/${filename}`;
|
|
1004
1004
|
resolve(newUrlPath);
|
|
1005
1005
|
});
|
|
@@ -1016,11 +1016,11 @@ async function copyFileFromS3ToMinio(bucket, url) {
|
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
(async () => {
|
|
1019
|
-
|
|
1019
|
+
log.info("Setup ids to keep");
|
|
1020
1020
|
await setupIdsToKeep();
|
|
1021
1021
|
//await deleteAll();
|
|
1022
1022
|
await copyAllToMinio();
|
|
1023
|
-
|
|
1023
|
+
log.info(`Destroying all except domain id ${domainIdToKeep} completed`);
|
|
1024
1024
|
process.exit();
|
|
1025
1025
|
})();
|
|
1026
1026
|
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import models from '../../models/index.cjs';
|
|
2
|
+
import log from "../../utils/loggerTs.js";
|
|
2
3
|
(async () => {
|
|
3
4
|
try {
|
|
4
5
|
const [userId, domainName, name] = process.argv.slice(2);
|
|
5
6
|
if (!domainName || !name) {
|
|
6
|
-
|
|
7
|
+
log.info('Usage: node createDomain.js <user_id> <domain_name> "<name>"');
|
|
7
8
|
process.exit(1);
|
|
8
9
|
}
|
|
9
10
|
const existing = await models.Domain.findOne({ where: { domain_name: domainName } });
|
|
10
11
|
if (existing) {
|
|
11
|
-
|
|
12
|
+
log.error(`Domain with domain_name ${domainName} already exists`);
|
|
12
13
|
process.exit(1);
|
|
13
14
|
}
|
|
14
15
|
const domain = await models.Domain.create({
|
|
@@ -21,11 +22,11 @@ import models from '../../models/index.cjs';
|
|
|
21
22
|
default_locale: 'en',
|
|
22
23
|
configuration: {}
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
+
log.info(`Created domain ${domain.name} with id ${domain.id}`);
|
|
25
26
|
process.exit(0);
|
|
26
27
|
}
|
|
27
28
|
catch (err) {
|
|
28
|
-
|
|
29
|
+
log.error(err);
|
|
29
30
|
process.exit(1);
|
|
30
31
|
}
|
|
31
32
|
})();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ExcelJS from 'exceljs';
|
|
2
2
|
import models from '../../models/index.cjs';
|
|
3
|
+
import log from "../../utils/loggerTs.js";
|
|
3
4
|
(async () => {
|
|
4
5
|
try {
|
|
5
6
|
const [xlsPath, clientId, clientSecret, issuer, authorizationURL, tokenURL, userInfoURL, endSessionURL,] = process.argv.slice(2);
|
|
6
7
|
if (!xlsPath) {
|
|
7
|
-
|
|
8
|
+
log.info('Usage: node importDomainsFromXls.js <path-to-xls> [clientId clientSecret issuer authorizationURL tokenURL userInfoURL endSessionURL]');
|
|
8
9
|
process.exit(1);
|
|
9
10
|
}
|
|
10
11
|
const oidcProvided = clientId &&
|
|
@@ -18,7 +19,7 @@ import models from '../../models/index.cjs';
|
|
|
18
19
|
await workbook.xlsx.readFile(xlsPath);
|
|
19
20
|
const worksheet = workbook.getWorksheet(1);
|
|
20
21
|
if (!worksheet) {
|
|
21
|
-
|
|
22
|
+
log.error('No worksheet found in file');
|
|
22
23
|
process.exit(1);
|
|
23
24
|
}
|
|
24
25
|
await models.sequelize.transaction(async (t) => {
|
|
@@ -54,7 +55,7 @@ import models from '../../models/index.cjs';
|
|
|
54
55
|
updateFields.secret_api_keys = secretKeys;
|
|
55
56
|
}
|
|
56
57
|
await existing.update(updateFields, { transaction: t });
|
|
57
|
-
|
|
58
|
+
log.info(`Updated domain ${existing.domain_name}`);
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
60
61
|
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
@@ -71,16 +72,16 @@ import models from '../../models/index.cjs';
|
|
|
71
72
|
configuration: {},
|
|
72
73
|
...(oidcKeys ? { secret_api_keys: { oidc: oidcKeys } } : {})
|
|
73
74
|
}, { transaction: t });
|
|
74
|
-
|
|
75
|
+
log.info(`Created domain ${domainName}`);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
await models.sequelize.close();
|
|
79
|
-
|
|
80
|
+
log.info('Import completed');
|
|
80
81
|
process.exit(0);
|
|
81
82
|
}
|
|
82
83
|
catch (err) {
|
|
83
|
-
|
|
84
|
+
log.error(err);
|
|
84
85
|
process.exit(1);
|
|
85
86
|
}
|
|
86
87
|
})();
|
|
@@ -11,7 +11,7 @@ const allowDeletingSingles = process.argv[4];
|
|
|
11
11
|
const allItems = [];
|
|
12
12
|
let deletedEndorsments = 0;
|
|
13
13
|
const postsToRecount = [];
|
|
14
|
-
|
|
14
|
+
log.info("Starting...");
|
|
15
15
|
function CSVToArray(strData, strDelimiter) {
|
|
16
16
|
// Check to see if the delimiter is defined. If not,
|
|
17
17
|
// then default to comma.
|
|
@@ -83,7 +83,7 @@ const processItemsToDestroy = (itemsToDestroy, callback) => {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
|
|
86
|
+
log.warn("Endorsement not found: " + item.endorsementId);
|
|
87
87
|
forEachItemCallback();
|
|
88
88
|
}
|
|
89
89
|
}).catch(error => {
|
|
@@ -132,7 +132,7 @@ async.series([
|
|
|
132
132
|
const options = {
|
|
133
133
|
url: urlToConfig,
|
|
134
134
|
};
|
|
135
|
-
|
|
135
|
+
log.info(`Get ${urlToConfig}`);
|
|
136
136
|
request.get(options, (error, content) => {
|
|
137
137
|
if (content && content.statusCode != 200) {
|
|
138
138
|
seriesCallback(content.statusCode);
|
|
@@ -140,7 +140,7 @@ async.series([
|
|
|
140
140
|
else if (content) {
|
|
141
141
|
config = content.body;
|
|
142
142
|
parsedConfig = CSVToArray(config);
|
|
143
|
-
|
|
143
|
+
log.info("Got content");
|
|
144
144
|
seriesCallback();
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
@@ -165,7 +165,7 @@ async.series([
|
|
|
165
165
|
postName: splitLine[10],
|
|
166
166
|
userAgent: splitLine[11]
|
|
167
167
|
});
|
|
168
|
-
|
|
168
|
+
log.info(`Will delete vote for ${splitLine[10]} from ${splitLine[8]}`);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
seriesCallback();
|
|
@@ -174,14 +174,14 @@ async.series([
|
|
|
174
174
|
const chunks = _.groupBy(allItems, function (endorsement) {
|
|
175
175
|
return endorsement.ipAddress + ":" + endorsement.postId + ":" + endorsement.userAgent;
|
|
176
176
|
});
|
|
177
|
-
|
|
177
|
+
log.info("Processing chunks");
|
|
178
178
|
async.forEachSeries(chunks, (items, forEachChunkCallback) => {
|
|
179
179
|
const itemsToDestroy = getAllItemsExceptOne(items);
|
|
180
180
|
if (itemsToDestroy.length > 0) {
|
|
181
181
|
processItemsToDestroy(itemsToDestroy, forEachChunkCallback);
|
|
182
182
|
}
|
|
183
183
|
else {
|
|
184
|
-
|
|
184
|
+
log.warn("Items length == 0 and no allowDeletingSingles, skipping");
|
|
185
185
|
forEachChunkCallback();
|
|
186
186
|
}
|
|
187
187
|
}, error => {
|
|
@@ -200,9 +200,9 @@ async.series([
|
|
|
200
200
|
}
|
|
201
201
|
], error => {
|
|
202
202
|
if (error)
|
|
203
|
-
|
|
203
|
+
log.error(error);
|
|
204
204
|
else
|
|
205
|
-
|
|
205
|
+
log.info(`Deleted ${deletedEndorsments} endorsements`);
|
|
206
206
|
process.exit();
|
|
207
207
|
});
|
|
208
208
|
export {};
|
|
@@ -22,15 +22,15 @@ models.PostStatusChange.findAll({
|
|
|
22
22
|
}).then(function (updates) {
|
|
23
23
|
async.eachSeries(updates, function (update, seriesCallback) {
|
|
24
24
|
if (update.content) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
log.info("------------------------------------------ STATUS CHANGE ID " + update.id + " ------------------------------------------");
|
|
26
|
+
log.info("\n");
|
|
27
|
+
log.info(update.content);
|
|
28
|
+
log.info("\n");
|
|
29
29
|
}
|
|
30
30
|
seriesCallback();
|
|
31
31
|
}, function () {
|
|
32
32
|
process.exit();
|
|
33
|
-
|
|
33
|
+
log.info("Done");
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
export {};
|
|
@@ -5,10 +5,10 @@ var fs = require('fs');
|
|
|
5
5
|
var communityId = process.argv[2];
|
|
6
6
|
var outFile = process.argv[3];
|
|
7
7
|
var clean = function (text) {
|
|
8
|
-
//
|
|
8
|
+
//log.info("Before: "+ text);
|
|
9
9
|
if (text) {
|
|
10
10
|
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(',', ';').trim();
|
|
11
|
-
//
|
|
11
|
+
//log.info("After:" + newText);
|
|
12
12
|
return newText.replace(/´/g, '');
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
@@ -51,7 +51,7 @@ models.Endorsement.findAll({
|
|
|
51
51
|
]
|
|
52
52
|
}).then(function (endorsements) {
|
|
53
53
|
var outFileContent = "";
|
|
54
|
-
|
|
54
|
+
log.info(endorsements.length);
|
|
55
55
|
outFileContent += "Post endorsements for Community Id: " + communityId + "\n";
|
|
56
56
|
outFileContent += "User Id, External User Id, State, Group Id, Post Id, Vote Value\n";
|
|
57
57
|
async.eachSeries(endorsements, function (endorsement, seriesCallback) {
|
|
@@ -69,9 +69,9 @@ models.Endorsement.findAll({
|
|
|
69
69
|
}, function (error) {
|
|
70
70
|
fs.writeFile(outFile, outFileContent, function (err) {
|
|
71
71
|
if (err) {
|
|
72
|
-
|
|
72
|
+
log.info(err);
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
log.info("The file was saved!");
|
|
75
75
|
process.exit();
|
|
76
76
|
});
|
|
77
77
|
});
|