@yrpri/api 9.0.103 → 9.0.104
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/package.json +1 -1
- package/dist/active-citizen/controllers/activities.cjs +0 -174
- package/dist/active-citizen/controllers/news_feeds.cjs +0 -96
- package/dist/active-citizen/controllers/notifications.cjs +0 -243
- package/dist/active-citizen/controllers/recommendations.cjs +0 -280
- package/dist/active-citizen/engine/allOurIdeas/aiHelper.js +0 -204
- package/dist/active-citizen/engine/allOurIdeas/explainAnswersAssistant.js +0 -66
- package/dist/active-citizen/engine/allOurIdeas/iconGenerator.js +0 -38
- package/dist/active-citizen/engine/analytics/export_anon_community_activities.js +0 -334
- package/dist/active-citizen/engine/analytics/importer.js +0 -308
- package/dist/active-citizen/engine/analytics/manager.cjs +0 -377
- package/dist/active-citizen/engine/analytics/plausible/manager.cjs +0 -500
- package/dist/active-citizen/engine/analytics/statsCalc.cjs +0 -194
- package/dist/active-citizen/engine/analytics/utils.cjs +0 -369
- package/dist/active-citizen/engine/marketing/campaign.cjs +0 -90
- package/dist/active-citizen/engine/moderation/fraud/CreateFraudAuditReport.cjs +0 -313
- package/dist/active-citizen/engine/moderation/fraud/FraudBase.cjs +0 -239
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteBase.cjs +0 -211
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteEndorsements.cjs +0 -120
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePointQualities.cjs +0 -114
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePoints.cjs +0 -101
- package/dist/active-citizen/engine/moderation/fraud/FraudDeletePosts.cjs +0 -84
- package/dist/active-citizen/engine/moderation/fraud/FraudDeleteRatings.cjs +0 -15
- package/dist/active-citizen/engine/moderation/fraud/FraudGetBase.cjs +0 -133
- package/dist/active-citizen/engine/moderation/fraud/FraudGetEndorsements.cjs +0 -185
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPointQualities.cjs +0 -184
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPoints.cjs +0 -170
- package/dist/active-citizen/engine/moderation/fraud/FraudGetPosts.cjs +0 -109
- package/dist/active-citizen/engine/moderation/fraud/FraudGetRatings.cjs +0 -140
- package/dist/active-citizen/engine/moderation/fraud/FraudScannerNotifier.cjs +0 -279
- package/dist/active-citizen/engine/moderation/get_moderation_items.cjs +0 -386
- package/dist/active-citizen/engine/moderation/image_labeling/CommunityLabeling.cjs +0 -49
- package/dist/active-citizen/engine/moderation/image_labeling/GroupLabeling.cjs +0 -68
- package/dist/active-citizen/engine/moderation/image_labeling/ImageLabelingBase.cjs +0 -288
- package/dist/active-citizen/engine/moderation/image_labeling/PointLabeling.cjs +0 -33
- package/dist/active-citizen/engine/moderation/image_labeling/PostLabeling.cjs +0 -56
- package/dist/active-citizen/engine/moderation/perspective_api_client.cjs +0 -106
- package/dist/active-citizen/engine/moderation/process_moderation_items.cjs +0 -344
- package/dist/active-citizen/engine/moderation/toxicity_analysis.cjs +0 -810
- package/dist/active-citizen/engine/news_feeds/activity_and_item_index_definitions.cjs +0 -15
- package/dist/active-citizen/engine/news_feeds/generate_dynamically.cjs +0 -362
- package/dist/active-citizen/engine/news_feeds/generate_from_notifications.cjs +0 -268
- package/dist/active-citizen/engine/news_feeds/news_feeds_utils.cjs +0 -439
- package/dist/active-citizen/engine/notifications/emails_utils.cjs +0 -569
- package/dist/active-citizen/engine/notifications/generate_point_notifications.cjs +0 -233
- package/dist/active-citizen/engine/notifications/generate_post_notifications.cjs +0 -118
- package/dist/active-citizen/engine/notifications/generate_post_status_change_notifications.cjs +0 -41
- package/dist/active-citizen/engine/notifications/notifications_utils.cjs +0 -148
- package/dist/active-citizen/engine/notifications/point_delivery.cjs +0 -54
- package/dist/active-citizen/engine/notifications/post_delivery.cjs +0 -31
- package/dist/active-citizen/engine/notifications/process_delayed_notifications.cjs +0 -471
- package/dist/active-citizen/engine/notifications/process_general_notifications.cjs +0 -212
- package/dist/active-citizen/engine/old/exporters/categories_dataset.js +0 -153
- package/dist/active-citizen/engine/old/exporters/dataset_tools.js +0 -80
- package/dist/active-citizen/engine/old/exporters/sentiment_dataset.js +0 -157
- package/dist/active-citizen/engine/recommendations/events_importer.cjs +0 -139
- package/dist/active-citizen/engine/recommendations/events_manager.cjs +0 -212
- package/dist/active-citizen/engine/reports/add_points_to_sheet.cjs +0 -83
- package/dist/active-citizen/engine/reports/commonUtils.js +0 -75
- package/dist/active-citizen/engine/reports/common_utils.cjs +0 -740
- package/dist/active-citizen/engine/reports/docx_group_report.cjs +0 -596
- package/dist/active-citizen/engine/reports/xlsAllOurIdeasExport.js +0 -232
- package/dist/active-citizen/engine/reports/xls_community_users_report.cjs +0 -277
- package/dist/active-citizen/engine/reports/xls_group_report.cjs +0 -718
- package/dist/active-citizen/llms/baseChatBot.js +0 -183
- package/dist/active-citizen/llms/imageGeneration/chatGptImageGenerator.js +0 -56
- package/dist/active-citizen/llms/imageGeneration/collectionImageGenerator.js +0 -109
- package/dist/active-citizen/llms/imageGeneration/dalleImageGenerator.js +0 -84
- package/dist/active-citizen/llms/imageGeneration/fluxImageGenerator.js +0 -49
- package/dist/active-citizen/llms/imageGeneration/iImageGenerator.js +0 -1
- package/dist/active-citizen/llms/imageGeneration/imageProcessorService.js +0 -64
- package/dist/active-citizen/llms/imageGeneration/imagenImageGenerator.js +0 -107
- package/dist/active-citizen/llms/imageGeneration/s3Service.js +0 -110
- package/dist/active-citizen/llms/llmTranslation.js +0 -472
- package/dist/active-citizen/models/ac_activity.cjs +0 -216
- package/dist/active-citizen/models/ac_background_job.cjs +0 -109
- package/dist/active-citizen/models/ac_campaign.cjs +0 -97
- package/dist/active-citizen/models/ac_client_activity.cjs +0 -23
- package/dist/active-citizen/models/ac_delayed_notification.cjs +0 -43
- package/dist/active-citizen/models/ac_following.cjs +0 -43
- package/dist/active-citizen/models/ac_list.cjs +0 -68
- package/dist/active-citizen/models/ac_list_users.cjs +0 -19
- package/dist/active-citizen/models/ac_mute.cjs +0 -27
- package/dist/active-citizen/models/ac_news_feed_item.cjs +0 -57
- package/dist/active-citizen/models/ac_news_feed_processed_range.cjs +0 -59
- package/dist/active-citizen/models/ac_notification.cjs +0 -292
- package/dist/active-citizen/models/ac_translation_cache.cjs +0 -750
- package/dist/active-citizen/models/ac_watching.cjs +0 -31
- package/dist/active-citizen/scripts/analytics/setup_all_plausible_goals.cjs +0 -13
- package/dist/active-citizen/scripts/fix_old_delayed_notifications.js +0 -63
- package/dist/active-citizen/scripts/kue_status.js +0 -31
- package/dist/active-citizen/scripts/kue_watch_stuck_jobs.js +0 -24
- package/dist/active-citizen/scripts/translation_clear_language.js +0 -117
- package/dist/active-citizen/scripts/translation_delete.js +0 -27
- package/dist/active-citizen/scripts/translation_replace_text_from_url.js +0 -180
- package/dist/active-citizen/scripts/translation_update.js +0 -28
- package/dist/active-citizen/scripts/translations_list.js +0 -27
- package/dist/active-citizen/utils/airbrake.cjs +0 -17
- package/dist/active-citizen/utils/get_anonymous_system_user.cjs +0 -21
- package/dist/active-citizen/utils/i18n.cjs +0 -3
- package/dist/active-citizen/utils/logger.cjs +0 -25
- package/dist/active-citizen/utils/redisConnection.cjs +0 -29
- package/dist/active-citizen/utils/to_json.cjs +0 -9
- package/dist/active-citizen/utils/translation_cloning.cjs +0 -171
- package/dist/active-citizen/utils/translation_helpers.cjs +0 -534
- package/dist/active-citizen/utils/truncate_text.cjs +0 -21
- package/dist/active-citizen/utils/updateAllLocalesFromEn.js +0 -253
- package/dist/active-citizen/utils/updateLocaleFolders.js +0 -34
- package/dist/active-citizen/workers/activity.cjs +0 -189
- package/dist/active-citizen/workers/anonymizations.cjs +0 -734
- package/dist/active-citizen/workers/bulk_status_update.cjs +0 -458
- package/dist/active-citizen/workers/delayed_jobs.cjs +0 -244
- package/dist/active-citizen/workers/deletions.cjs +0 -1911
- package/dist/active-citizen/workers/email.cjs +0 -9
- package/dist/active-citizen/workers/fraud_management.cjs +0 -109
- package/dist/active-citizen/workers/generativeAi.js +0 -56
- package/dist/active-citizen/workers/main.cjs +0 -89
- package/dist/active-citizen/workers/marketing.cjs +0 -25
- package/dist/active-citizen/workers/moderation.cjs +0 -73
- package/dist/active-citizen/workers/notification_delivery.cjs +0 -368
- package/dist/active-citizen/workers/notification_news_feed.cjs +0 -142
- package/dist/active-citizen/workers/queue.cjs +0 -99
- package/dist/active-citizen/workers/recount.cjs +0 -74
- package/dist/active-citizen/workers/reports.cjs +0 -42
- package/dist/active-citizen/workers/similarities.cjs +0 -21
- package/dist/active-citizen/workers/speech_to_text.cjs +0 -482
- package/dist/agents/assistants/agentAssistant.js +0 -88
- package/dist/agents/assistants/baseAssistant.js +0 -888
- package/dist/agents/assistants/baseAssistantWithVoice.js +0 -150
- package/dist/agents/assistants/modes/agentDirectConnection.js +0 -84
- package/dist/agents/assistants/modes/agentSelectionMode.js +0 -44
- package/dist/agents/assistants/modes/baseAssistantMode.js +0 -54
- package/dist/agents/assistants/modes/tools/agentTools.js +0 -447
- package/dist/agents/assistants/modes/tools/baseTools.js +0 -58
- package/dist/agents/assistants/modes/tools/loginTools.js +0 -156
- package/dist/agents/assistants/modes/tools/models/agents.js +0 -146
- package/dist/agents/assistants/modes/tools/models/subscriptions.js +0 -332
- package/dist/agents/assistants/modes/tools/models/users.js +0 -11
- package/dist/agents/assistants/modes/tools/navigationTools.js +0 -166
- package/dist/agents/assistants/modes/tools/subscriptionTools.js +0 -323
- package/dist/agents/assistants/modes/tools/workflowConverstationTools.js +0 -112
- package/dist/agents/assistants/voiceAssistant.js +0 -619
- package/dist/agents/controllers/agentProductController.js +0 -103
- package/dist/agents/controllers/agentSubscriptionController.js +0 -261
- package/dist/agents/controllers/assistantsController.js +0 -511
- package/dist/agents/controllers/policySynthAgents.js +0 -395
- package/dist/agents/managers/agentProductManager.js +0 -91
- package/dist/agents/managers/emailInvitesManager.js +0 -55
- package/dist/agents/managers/emailTemplateRenderer.js +0 -362
- package/dist/agents/managers/newAiModelSetup.js +0 -650
- package/dist/agents/managers/notificationAgentQueueManager.js +0 -510
- package/dist/agents/managers/subscriptionManager.js +0 -535
- package/dist/agents/managers/workflowConversationManager.js +0 -79
- package/dist/agents/models/agentProduct.js +0 -116
- package/dist/agents/models/agentProductBoosterPurchase.js +0 -58
- package/dist/agents/models/agentProductBundle.js +0 -68
- package/dist/agents/models/agentProductRun.js +0 -52
- package/dist/agents/models/discount.js +0 -88
- package/dist/agents/models/subscription.js +0 -79
- package/dist/agents/models/subscriptionPlan.js +0 -46
- package/dist/agents/models/subscriptionUser.js +0 -27
- package/dist/agents/models/testData/createEvolyAgentProduct.js +0 -477
- package/dist/agents/models/testData/old/updateAgentWorkflowConfiguration.js +0 -230
- package/dist/agents/models/testData/setupEvolyAgentProductConfig.js +0 -233
- package/dist/agents/models/testData/updateAgentWorkflowConfiguration.js +0 -230
- package/dist/agents/models/workflowConversation.js +0 -53
- package/dist/agents/tools/setTemplateWorkflowCommunityId.js +0 -46
- package/dist/app.js +0 -943
- package/dist/authorization.cjs +0 -1860
- package/dist/bot_control.js +0 -1930
- package/dist/config/config.cjs +0 -14
- package/dist/config/config.js +0 -14
- package/dist/controllers/allOurIdeas.js +0 -696
- package/dist/controllers/audios.cjs +0 -100
- package/dist/controllers/bulkStatusUpdates.cjs +0 -202
- package/dist/controllers/categories.cjs +0 -199
- package/dist/controllers/communities.cjs +0 -2996
- package/dist/controllers/domains.cjs +0 -1341
- package/dist/controllers/externalIds.cjs +0 -223
- package/dist/controllers/groups.cjs +0 -4309
- package/dist/controllers/images.cjs +0 -499
- package/dist/controllers/index.cjs +0 -449
- package/dist/controllers/legacyPages.cjs +0 -35
- package/dist/controllers/legacyPosts.cjs +0 -56
- package/dist/controllers/legacyUsers.cjs +0 -36
- package/dist/controllers/nonSpa.cjs +0 -574
- package/dist/controllers/organizations.cjs +0 -250
- package/dist/controllers/points.cjs +0 -1137
- package/dist/controllers/posts.cjs +0 -2036
- package/dist/controllers/ratings.cjs +0 -234
- package/dist/controllers/users.cjs +0 -2255
- package/dist/controllers/videos.cjs +0 -226
- package/dist/deleteUnwantedDeclerations.cjs +0 -55
- package/dist/migrations/agentAuditLogs.cjs +0 -46
- package/dist/migrations/agentClasses.cjs +0 -60
- package/dist/migrations/agentConnectorClasses.cjs +0 -61
- package/dist/migrations/agentConnectors.cjs +0 -50
- package/dist/migrations/agentEvals.cjs +0 -45
- package/dist/migrations/agentRegistries.cjs +0 -40
- package/dist/migrations/agents.cjs +0 -54
- package/dist/migrations/aiModels.cjs +0 -49
- package/dist/migrations/apiUsage.cjs +0 -47
- package/dist/migrations/apis.cjs +0 -49
- package/dist/migrations/groupPrivateData.cjs +0 -30
- package/dist/migrations/modelUsage.cjs +0 -60
- package/dist/migrations/oldMigrations/2019/20181030020612-AddActivitiesIndex.js +0 -23
- package/dist/migrations/oldMigrations/2019/20181102210612-AddFirstVideoFeatures.js +0 -360
- package/dist/migrations/oldMigrations/2019/20181212210612-ModerationFeatures.js +0 -29
- package/dist/migrations/oldMigrations/2019/2019010610612-CommunityFolders.js +0 -43
- package/dist/migrations/oldMigrations/2019/20190117020612-AddMissingIndexes.js +0 -24
- package/dist/migrations/oldMigrations/2019/20190117020612-RemoveUnusedIndexes.js +0 -29
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartThree.js +0 -22
- package/dist/migrations/oldMigrations/2019/20190127020612-RemoveUnusedIndexesPartTwo.js +0 -23
- package/dist/migrations/oldMigrations/2019/20190223020612-AddPrivateProfileDataToUsers.js +0 -18
- package/dist/migrations/oldMigrations/2019/20190706210612-AddCustomRatings.js +0 -43
- package/dist/migrations/oldMigrations/2019/20190829210612-AddGeneralStore.js +0 -36
- package/dist/migrations/oldMigrations/2019/20192811210612-AddAcClientActivities.js +0 -41
- package/dist/migrations/oldMigrations/2020/20190527020612-WorkOnIndexes.js +0 -88
- package/dist/migrations/oldMigrations/2020/20200409020612-AddBackgroundJob.js +0 -33
- package/dist/migrations/oldMigrations/2020/20200716210612-AddDataToCollections.js +0 -38
- package/dist/migrations/oldMigrations/2022/20220215100612-AddDataToEndorsements.js +0 -19
- package/dist/migrations/oldMigrations/2022/20220220100612-AddDataForFraudDetection.js +0 -19
- package/dist/migrations/oldMigrations/2022/20220903100612-AddPromotionFeatures.js +0 -127
- package/dist/migrations/oldMigrations/2022/onHold/20200527020612-AddCampaigns.js +0 -68
- package/dist/migrations/oldMigrations/2024/20241304175112-AddMediaSupportForHtmlGroups.cjs +0 -63
- package/dist/migrations/oldMigrations/older/20160511172514-AddNotificationFeatures.js +0 -14
- package/dist/migrations/oldMigrations/older/20161030020612-AddBulkStatusUpdate.js +0 -71
- package/dist/migrations/oldMigrations/older/20170514035258-add-metadata-to-invites.js +0 -12
- package/dist/migrations/oldMigrations/older/20180216020612-AddTranslationCaches.js +0 -46
- package/dist/migrations/oldMigrations/older/20180218210612-AddTranslationAndLanguages.js +0 -46
- package/dist/migrations/privateAccessStore.cjs +0 -55
- package/dist/migrations/zzz_associations.cjs +0 -154
- package/dist/migrations/zzzz_createUsersAndAdminsForClasses.cjs +0 -100
- package/dist/migrations/zzzzz_create_agent_runs.cjs +0 -606
- package/dist/migrations/zzzzzz_create_agent_runs_fix.cjs +0 -11
- package/dist/migrations/zzzzzzz_create_trees.cjs +0 -81
- package/dist/models/audio.cjs +0 -430
- package/dist/models/bulk_status_update.cjs +0 -58
- package/dist/models/campaign.cjs +0 -78
- package/dist/models/category.cjs +0 -94
- package/dist/models/community.cjs +0 -337
- package/dist/models/domain.cjs +0 -486
- package/dist/models/endorsement.cjs +0 -39
- package/dist/models/general_data_store.cjs +0 -20
- package/dist/models/group.cjs +0 -728
- package/dist/models/image.cjs +0 -579
- package/dist/models/index.cjs +0 -186
- package/dist/models/invite.cjs +0 -48
- package/dist/models/iso_country.cjs +0 -16
- package/dist/models/organization.cjs +0 -122
- package/dist/models/page.cjs +0 -273
- package/dist/models/point.cjs +0 -622
- package/dist/models/point_quality.cjs +0 -39
- package/dist/models/point_revision.cjs +0 -47
- package/dist/models/post.cjs +0 -680
- package/dist/models/post_revision.cjs +0 -38
- package/dist/models/post_status_change.cjs +0 -35
- package/dist/models/promotion.cjs +0 -34
- package/dist/models/rating.cjs +0 -51
- package/dist/models/relationship.cjs +0 -19
- package/dist/models/request_to_join.cjs +0 -20
- package/dist/models/user.cjs +0 -604
- package/dist/models/user_legacy_password.cjs +0 -13
- package/dist/models/video.cjs +0 -1137
- package/dist/publish.js +0 -40
- package/dist/repack.js +0 -53
- package/dist/scripts/addRatingUsersToGroup.js +0 -51
- package/dist/scripts/addUserToOrganization.js +0 -71
- package/dist/scripts/analyseRatingsForCommunity.js +0 -150
- package/dist/scripts/analyzeAndFixBrokenPointUsers.js +0 -28
- package/dist/scripts/analyzeEndorsementsByCountry.js +0 -70
- package/dist/scripts/analyzePostsForCommunity.js +0 -185
- package/dist/scripts/bulkStatusUpdates/listUpdates.js +0 -14
- package/dist/scripts/bulkStatusUpdates/mergeLatestPostsToUpdate.js +0 -110
- package/dist/scripts/bulkStatusUpdates/performUpdate.js +0 -116
- package/dist/scripts/bulkStatusUpdates/performUpdateForGroup.cjs +0 -124
- package/dist/scripts/bulkStatusUpdates/performUpdateForStatus.js +0 -141
- package/dist/scripts/change/changeVideoAspectTo.js +0 -34
- package/dist/scripts/change/setUseNewVersion.cjs +0 -22
- package/dist/scripts/changeCommunityGroupcount.js +0 -30
- package/dist/scripts/changeCommunityPostCount.js +0 -30
- package/dist/scripts/changeGroupPostCount.js +0 -30
- package/dist/scripts/changeLanguage.js +0 -50
- package/dist/scripts/changeOfficalStatus.js +0 -30
- package/dist/scripts/cleanups/deleteAnonNotifications.cjs +0 -91
- package/dist/scripts/cleanups/deleteLinkGroupsWithDeletedCommunities.js +0 -62
- package/dist/scripts/cleanups/deleteYearOldNotifications.cjs +0 -72
- package/dist/scripts/cleanups/removeAllUsersFromHiddenPublicGroup.js +0 -43
- package/dist/scripts/clearAllEndorsementInGroup.js +0 -50
- package/dist/scripts/cloning/clearUsersForCommunitiesFromUrl.js +0 -129
- package/dist/scripts/cloning/cloneFromUrlScript.js +0 -65
- package/dist/scripts/cloning/cloneWBFromUrlScriptAndCreateLinks.js +0 -140
- package/dist/scripts/cloning/cloneWBFromUrlScriptNoUsersOrPoints.js +0 -140
- package/dist/scripts/cloning/cloneWBSerbianFromUrlScriptAndCreateLinks.js +0 -131
- package/dist/scripts/cloning/copyCommunityConfigAndTranslationsFromURL.js +0 -173
- package/dist/scripts/cloning/copyCommunityOneGroupToDomainNoUsersNoEndorsements.js +0 -18
- package/dist/scripts/cloning/copyCommunityToDomainNoUsersNoEndorsements.js +0 -17
- package/dist/scripts/cloning/copyCommunityToDomainWithEverything.js +0 -17
- package/dist/scripts/cloning/copyCommunityToDomainWithOnlyGroups.js +0 -26
- package/dist/scripts/cloning/copyGroupConfigAndTranslationsFromURL.js +0 -205
- package/dist/scripts/cloning/copyPostToGroupOld.js +0 -397
- package/dist/scripts/cloning/copyPostVideosFromURL.js +0 -236
- package/dist/scripts/cloning/copyPostWithOutAnyVotingOrActivities.js +0 -17
- package/dist/scripts/cloning/deepCloneSerbianWBFromUrlScriptAndCreateLinks.js +0 -131
- package/dist/scripts/cloning/deepCloneWBFromUrlScriptAndCreateLinks.js +0 -139
- package/dist/scripts/cloning/setAdminsFromURL.js +0 -161
- package/dist/scripts/cloning/setExternalIdsFromURL.js +0 -129
- package/dist/scripts/countCommunity.js +0 -291
- package/dist/scripts/countCommunityUsers.js +0 -152
- package/dist/scripts/countDelayedNotifications.js +0 -18
- package/dist/scripts/countGroup.js +0 -246
- package/dist/scripts/countStuff.js +0 -67
- package/dist/scripts/countUniqueVotersInAGroup.js +0 -48
- package/dist/scripts/createInvitesAndShow.js +0 -75
- package/dist/scripts/database/sync_database.js +0 -14
- package/dist/scripts/database/sync_dev_database.js +0 -17
- package/dist/scripts/debugNotifications.js +0 -58
- package/dist/scripts/deleteAllNewsFeeds.js +0 -10
- package/dist/scripts/deleteCategory.js +0 -13
- package/dist/scripts/deleteOldAppActivities.js +0 -40
- package/dist/scripts/deletePostContactDataForCommunity.js +0 -53
- package/dist/scripts/destroy/destroy_all_but_one_domain.js +0 -1026
- package/dist/scripts/displayAuthorForPost.js +0 -16
- package/dist/scripts/endorsementFraudDetection/analyseEndorsementsForCommunity.js +0 -183
- package/dist/scripts/endorsementFraudDetection/bulkDeleteDuplicateEndorsmentsFromUrl.js +0 -208
- package/dist/scripts/exportAllStatusChanges.js +0 -36
- package/dist/scripts/exportClientAcitivity.js +0 -36
- package/dist/scripts/exportEndorsementsForCommunity.js +0 -79
- package/dist/scripts/exportPointQualitiesForCommunity.js +0 -84
- package/dist/scripts/exportPostsAndPointsForCommunity.js +0 -147
- package/dist/scripts/exportPostsDataSetForDomain.js +0 -244
- package/dist/scripts/exportPostsForGroup.js +0 -173
- package/dist/scripts/exportRatingsForPost.js +0 -15
- package/dist/scripts/exportUserEndorsementsWithUserAnalysis.js +0 -123
- package/dist/scripts/exportUsersForCommunity.js +0 -24
- package/dist/scripts/exportUsersForDomain.js +0 -24
- package/dist/scripts/exportUsersForGroup.js +0 -24
- package/dist/scripts/exports/ratingDistribution.js +0 -71
- package/dist/scripts/exports/whoEndorsedWhatByCommunity.js +0 -56
- package/dist/scripts/findUnusedClientImports.js +0 -56
- package/dist/scripts/fixAllPostPointCounts.js +0 -22
- package/dist/scripts/fixAnonNotificationsSettings.js +0 -48
- package/dist/scripts/fixCountKopavogur.js +0 -9
- package/dist/scripts/fixEndorsementsAfterCopyPostToGroup.js +0 -190
- package/dist/scripts/fixExternalUserId.js +0 -24
- package/dist/scripts/fixGroupAccess.js +0 -16
- package/dist/scripts/fixGroupIdeasAndPointsCount.js +0 -49
- package/dist/scripts/fixNotificationSettings.js +0 -39
- package/dist/scripts/fixSurveyRadioBakedInSubCodes.js +0 -64
- package/dist/scripts/fixWrongUserIdForStatusUpdates.js +0 -49
- package/dist/scripts/gallery/exportGalleryData.js +0 -40
- package/dist/scripts/gallery/importGalleryForCommunity.js +0 -168
- package/dist/scripts/gallery/readJsonAndDownloadImagesVersion2.js +0 -55
- package/dist/scripts/gallery/refreshAcApiPostIdsForCommunity.js +0 -58
- package/dist/scripts/genderAnalysis.js +0 -63
- package/dist/scripts/genderAnalysisByStatus.js +0 -62
- package/dist/scripts/importAllLocalesFromLocalFolders.js +0 -55
- package/dist/scripts/importDomain.js +0 -1652
- package/dist/scripts/keys/addOidcToDomain.cjs +0 -61
- package/dist/scripts/landUseGame/export3Ddata.js +0 -162
- package/dist/scripts/listLanguagesForGroup.js +0 -54
- package/dist/scripts/loadTestCreateDummyContentForGroup.js +0 -27
- package/dist/scripts/makeRecursiveMapData.js +0 -103
- package/dist/scripts/mapping/community_map_csv.js +0 -145
- package/dist/scripts/moveCommunityToDomain.js +0 -22
- package/dist/scripts/moveGroupToCommunity.js +0 -23
- package/dist/scripts/movePostToGroup.js +0 -101
- package/dist/scripts/movePostsToGroupsRecountGroupFromUrl.js +0 -297
- package/dist/scripts/oldMovePostToGroup.js +0 -153
- package/dist/scripts/processCsvForPdfUrls.js +0 -37
- package/dist/scripts/processCsvForTranslationAndToxicity.js +0 -125
- package/dist/scripts/recount/recount_recursive_communities.js +0 -125
- package/dist/scripts/recountALLCommunityGroupCounts.js +0 -37
- package/dist/scripts/recountAll.js +0 -97
- package/dist/scripts/recountCommunitesFromUrl.js +0 -58
- package/dist/scripts/recountCommunity.js +0 -19
- package/dist/scripts/recountGroup.js +0 -218
- package/dist/scripts/recountGroupNoUserChange.js +0 -219
- package/dist/scripts/resetAllEndorsementsForGroup.js +0 -57
- package/dist/scripts/resetEnTranslationForGroup.js +0 -45
- package/dist/scripts/setAdminOnAll.cjs +0 -107
- package/dist/scripts/setDomainAdmin.cjs +0 -43
- package/dist/scripts/setDomainLocales.js +0 -33
- package/dist/scripts/setEarlQuestionIdOnGroup.cjs +0 -29
- package/dist/scripts/setLanguageOnGroupCommunitesFromUrl.js +0 -86
- package/dist/scripts/setMemberOfAll.js +0 -101
- package/dist/scripts/setNewUserForContentOfCommunity.js +0 -189
- package/dist/scripts/setOfficialStatusOnAllPostsForCommunity.js +0 -35
- package/dist/scripts/setUserOnAll.js +0 -101
- package/dist/scripts/showCategoryForGroup.js +0 -18
- package/dist/scripts/showOldActivityTypes.js +0 -14
- package/dist/scripts/showPostsMissingCategoryForGroup.js +0 -17
- package/dist/scripts/showStatuses.js +0 -17
- package/dist/scripts/showUniqueVotersInCommunity.js +0 -61
- package/dist/scripts/showUserAgentsAndIpsForEmails.js +0 -66
- package/dist/scripts/simpleExportForGroupsForCommunity.js +0 -46
- package/dist/scripts/simpleExportForPointsForCommunity.js +0 -82
- package/dist/scripts/simpleExportForPostsForCommunity.js +0 -61
- package/dist/scripts/testForEndorsments.js +0 -21
- package/dist/scripts/undeleteGroupAndAllContent.js +0 -151
- package/dist/scripts/undeletePost.js +0 -135
- package/dist/scripts/unlinkSsn.js +0 -23
- package/dist/scripts/updateFromAlthingi.js +0 -303
- package/dist/server.js +0 -3
- package/dist/utils/airbrake.cjs +0 -17
- package/dist/utils/cjsCodeReview.js +0 -99
- package/dist/utils/community_mapping_tools.cjs +0 -124
- package/dist/utils/copy_utils.cjs +0 -1399
- package/dist/utils/docx_utils.cjs +0 -464
- package/dist/utils/export_utils.cjs +0 -491
- package/dist/utils/i18n.cjs +0 -17
- package/dist/utils/is_valid_db_id.cjs +0 -28
- package/dist/utils/logger.cjs +0 -25
- package/dist/utils/loggerTs.js +0 -26
- package/dist/utils/manifest_generator.cjs +0 -104
- package/dist/utils/parse_domain.cjs +0 -16
- package/dist/utils/recount_utils.cjs +0 -415
- package/dist/utils/sharing_parameters.cjs +0 -111
- package/dist/utils/sitemap_generator.cjs +0 -286
- package/dist/utils/to_json.cjs +0 -14
- package/dist/utils/ypLanguages.js +0 -747
- package/dist/webSockets.js +0 -77
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
const models = require('../models/index.cjs');
|
|
2
|
-
const async = require('async');
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
var communityId = 1017; // process.argv[2];
|
|
6
|
-
var outFile = process.argv[3];
|
|
7
|
-
let outFileContent = "";
|
|
8
|
-
const clean = (text) => {
|
|
9
|
-
//console.log("Before: "+ text);
|
|
10
|
-
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
11
|
-
//console.log("After:" + newText);
|
|
12
|
-
return newText.replace(/´/g, '');
|
|
13
|
-
};
|
|
14
|
-
const getPoints = (points) => {
|
|
15
|
-
var totalContent = "";
|
|
16
|
-
_.each(points, function (point) {
|
|
17
|
-
var content = clean(point.content) + "\n\n";
|
|
18
|
-
if (content.startsWith(",")) {
|
|
19
|
-
content = content.substr(1);
|
|
20
|
-
}
|
|
21
|
-
console.log("content: " + content);
|
|
22
|
-
totalContent += content;
|
|
23
|
-
});
|
|
24
|
-
return totalContent;
|
|
25
|
-
};
|
|
26
|
-
const getPointsUpOrDown = (post, value) => {
|
|
27
|
-
var pointsText = '"';
|
|
28
|
-
var points = _.filter(post.Points, function (point) {
|
|
29
|
-
if (value > 0) {
|
|
30
|
-
return point.value > 0;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return point.value < 0;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
pointsText += getPoints(points) + '"';
|
|
37
|
-
if (pointsText.startsWith(",")) {
|
|
38
|
-
pointsText = pointsText.substr(1);
|
|
39
|
-
}
|
|
40
|
-
console.log("PointText: " + pointsText);
|
|
41
|
-
return pointsText;
|
|
42
|
-
};
|
|
43
|
-
const getToxicityScore = (model) => {
|
|
44
|
-
if (model.data && model.data.moderation && model.data.moderation.toxicityScore) {
|
|
45
|
-
return model.data.moderation.toxicityScore;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return "";
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const getPointsUp = (post) => {
|
|
52
|
-
return getPointsUpOrDown(post, 1);
|
|
53
|
-
};
|
|
54
|
-
const getPointsDown = (post) => {
|
|
55
|
-
return getPointsUpOrDown(post, -1);
|
|
56
|
-
};
|
|
57
|
-
const addCrowdsourcingRow = (contentType, category, subject, content, forAgainstValue, upVotes, downVotes, id, toxicityScore, englishTranslation) => {
|
|
58
|
-
outFileContent += 'Crowdsourcing,' + contentType + ',"' + category + '"' + ',"' + subject + '","' + clean(content) + '","' + forAgainstValue + '","' +
|
|
59
|
-
upVotes + '",' + '"' + downVotes + '",' + '"' + id + '",' + '"' + toxicityScore + '",' + '"' + clean(englishTranslation) + '",' + '\n';
|
|
60
|
-
};
|
|
61
|
-
models.Post.findAll({
|
|
62
|
-
attributes: ['id', 'name', 'description', 'counter_endorsements_up', 'counter_endorsements_down', 'data'],
|
|
63
|
-
order: [
|
|
64
|
-
['created_at', 'asc']
|
|
65
|
-
],
|
|
66
|
-
include: [
|
|
67
|
-
{
|
|
68
|
-
model: models.Group,
|
|
69
|
-
required: true,
|
|
70
|
-
attributes: ['id', 'name'],
|
|
71
|
-
include: [
|
|
72
|
-
{
|
|
73
|
-
model: models.Community,
|
|
74
|
-
required: true,
|
|
75
|
-
where: { id: communityId }
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}).then(function (posts) {
|
|
81
|
-
async.eachSeries(posts, function (post, seriesCallback) {
|
|
82
|
-
let req = {
|
|
83
|
-
query: {
|
|
84
|
-
textType: 'postContent',
|
|
85
|
-
targetLanguage: 'en'
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
models.AcTranslationCache.getTranslation(req, post, (error, translation) => {
|
|
89
|
-
let englishTranslation = "no translation";
|
|
90
|
-
if (!error && translation) {
|
|
91
|
-
englishTranslation = translation.content;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.error(error);
|
|
95
|
-
}
|
|
96
|
-
addCrowdsourcingRow('post', post.Group.name, post.name, post.description, 0, post.counter_endorsements_up, post.counter_endorsements_down, post.id, getToxicityScore(post), englishTranslation);
|
|
97
|
-
models.Point.findAll({
|
|
98
|
-
attributes: ['id', 'content', 'counter_quality_up', 'counter_quality_down', 'value', 'data'],
|
|
99
|
-
where: { post_id: post.id },
|
|
100
|
-
order: [
|
|
101
|
-
['value', 'asc']
|
|
102
|
-
],
|
|
103
|
-
include: [{
|
|
104
|
-
model: models.PointRevision,
|
|
105
|
-
attributes: ['id', 'content']
|
|
106
|
-
}]
|
|
107
|
-
}).then(function (points) {
|
|
108
|
-
async.eachSeries(points, function (point, pointsCallback) {
|
|
109
|
-
let pointTextContent;
|
|
110
|
-
if (point.PointRevisions.length > 0) {
|
|
111
|
-
pointTextContent = point.PointRevisions[point.PointRevisions.length - 1].content;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
pointTextContent = point.content;
|
|
115
|
-
}
|
|
116
|
-
console.log(pointTextContent);
|
|
117
|
-
let req = {
|
|
118
|
-
query: {
|
|
119
|
-
textType: 'pointContent',
|
|
120
|
-
targetLanguage: 'en'
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
models.AcTranslationCache.getTranslation(req, point, (error, translation) => {
|
|
124
|
-
let englishTranslation = "no translation";
|
|
125
|
-
if (!error && translation) {
|
|
126
|
-
englishTranslation = translation.content;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
console.error(error);
|
|
130
|
-
}
|
|
131
|
-
addCrowdsourcingRow('point', post.Group.name, post.name, pointTextContent, point.value, point.counter_quality_up, point.counter_quality_down, point.id, getToxicityScore(point), englishTranslation);
|
|
132
|
-
pointsCallback();
|
|
133
|
-
});
|
|
134
|
-
}, seriesCallback);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}, function (error) {
|
|
138
|
-
fs.writeFile(outFile, outFileContent, function (err) {
|
|
139
|
-
if (err) {
|
|
140
|
-
console.log(err);
|
|
141
|
-
}
|
|
142
|
-
console.log("The file was saved!");
|
|
143
|
-
process.exit();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
export {};
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var domainId = process.argv[2];
|
|
6
|
-
var outFolderPath = process.argv[3];
|
|
7
|
-
var skipEmail = false;
|
|
8
|
-
var getPostUrl = function (post) {
|
|
9
|
-
if (urlPrefix) {
|
|
10
|
-
return urlPrefix + '/post/' + post.id;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return "https://yrpri.org/post/" + post.id;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var getUserEmail = function (post) {
|
|
17
|
-
if (skipEmail) {
|
|
18
|
-
return "hidden";
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return post.User.email;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var clean = function (text) {
|
|
25
|
-
if (text) {
|
|
26
|
-
//console.log("Before: "+ text);
|
|
27
|
-
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
28
|
-
//console.log("After:" + newText);
|
|
29
|
-
return newText.replace(/´/g, '');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return "";
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var getLocation = function (post) {
|
|
36
|
-
if (post.location && post.location.latitude && post.location.longitude &&
|
|
37
|
-
post.location.latitude != "" && post.location.longitude != "") {
|
|
38
|
-
return post.location.latitude + ',' + post.location.longitude;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return '"",""';
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var getPoints = function (points) {
|
|
45
|
-
var totalContent = "";
|
|
46
|
-
_.each(points, function (point) {
|
|
47
|
-
var content = clean(point.content) + "\n\n";
|
|
48
|
-
if (content.startsWith(",")) {
|
|
49
|
-
content = content.substr(1);
|
|
50
|
-
}
|
|
51
|
-
console.log("content: " + content);
|
|
52
|
-
totalContent += content;
|
|
53
|
-
});
|
|
54
|
-
return totalContent;
|
|
55
|
-
};
|
|
56
|
-
var getPointsUpOrDown = function (post, value) {
|
|
57
|
-
var pointsText = '';
|
|
58
|
-
var points = _.filter(post.Points, function (point) {
|
|
59
|
-
if (value > 0) {
|
|
60
|
-
return point.value > 0;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return point.value < 0;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
pointsText += getPoints(points) + '';
|
|
67
|
-
if (pointsText.startsWith(",")) {
|
|
68
|
-
pointsText = pointsText.substr(1);
|
|
69
|
-
}
|
|
70
|
-
console.log("PointText: " + pointsText);
|
|
71
|
-
return pointsText;
|
|
72
|
-
};
|
|
73
|
-
var getPointsUp = function (post) {
|
|
74
|
-
return getPointsUpOrDown(post, 1);
|
|
75
|
-
};
|
|
76
|
-
var getPointsDown = function (post) {
|
|
77
|
-
return getPointsUpOrDown(post, -1);
|
|
78
|
-
};
|
|
79
|
-
var getNewFromUsers = function (post) {
|
|
80
|
-
return "";
|
|
81
|
-
};
|
|
82
|
-
var getImageFormatUrl = function (image, formatId) {
|
|
83
|
-
var formats = JSON.parse(image.formats);
|
|
84
|
-
if (formats && formats.length > 0)
|
|
85
|
-
return formats[formatId];
|
|
86
|
-
else
|
|
87
|
-
return "";
|
|
88
|
-
};
|
|
89
|
-
var getImages = function (post) {
|
|
90
|
-
var imagesText = "";
|
|
91
|
-
if (post.PostHeaderImages && post.PostHeaderImages.length > 0) {
|
|
92
|
-
imagesText += _.map(post.PostHeaderImages, function (image) {
|
|
93
|
-
return "" + getImageFormatUrl(image, 0) + " ";
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
if (post.PostHeaderImages && post.PostUserImages.length > 0) {
|
|
97
|
-
imagesText += _.map(post.PostUserImages, function (image) {
|
|
98
|
-
return "" + getImageFormatUrl(image, 0) + " ";
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return imagesText;
|
|
102
|
-
};
|
|
103
|
-
var getCategory = function (post) {
|
|
104
|
-
if (post.Category) {
|
|
105
|
-
return post.Category.name;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return "";
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
models.Post.unscoped().findAll({
|
|
112
|
-
order: [
|
|
113
|
-
['created_at', 'asc']
|
|
114
|
-
],
|
|
115
|
-
include: [
|
|
116
|
-
{
|
|
117
|
-
model: models.Category,
|
|
118
|
-
required: false
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
model: models.PostRevision,
|
|
122
|
-
required: false
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
model: models.Group,
|
|
126
|
-
attributes: ['id'],
|
|
127
|
-
include: [
|
|
128
|
-
{
|
|
129
|
-
model: models.Community,
|
|
130
|
-
attributes: ['id'],
|
|
131
|
-
where: {
|
|
132
|
-
access: models.Community.ACCESS_PUBLIC
|
|
133
|
-
},
|
|
134
|
-
include: [
|
|
135
|
-
{
|
|
136
|
-
model: models.Domain,
|
|
137
|
-
where: {
|
|
138
|
-
id: domainId
|
|
139
|
-
},
|
|
140
|
-
attributes: ['id']
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
model: models.Point,
|
|
148
|
-
attributes: ['id', 'content', 'value'],
|
|
149
|
-
required: false
|
|
150
|
-
},
|
|
151
|
-
{ model: models.Image,
|
|
152
|
-
as: 'PostHeaderImages',
|
|
153
|
-
required: false
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
model: models.User,
|
|
157
|
-
required: true
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
model: models.Image,
|
|
161
|
-
as: 'PostUserImages',
|
|
162
|
-
required: false,
|
|
163
|
-
where: {
|
|
164
|
-
deleted: false
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
}).then(function (posts) {
|
|
169
|
-
var outFilePostContent = "";
|
|
170
|
-
var outFilePointForContent = "";
|
|
171
|
-
var outFilePointAgainstContent = "";
|
|
172
|
-
console.log(posts.length);
|
|
173
|
-
var postCounter = 0;
|
|
174
|
-
async.eachSeries(posts, function (post, seriesCallback) {
|
|
175
|
-
if (!post.deleted) {
|
|
176
|
-
outFilePostContent += "Name: " + clean(post.name) + "\n" + clean(post.description) + "\n\n";
|
|
177
|
-
outFilePointForContent += getPointsUp(post);
|
|
178
|
-
outFilePointAgainstContent += getPointsDown(post);
|
|
179
|
-
async.series([
|
|
180
|
-
(innerSeriesCallback) => {
|
|
181
|
-
var outFileName = outFolderPath + "/posts/" + post.id + "_post_" + (post.language ? post.language : "??") + ".txt";
|
|
182
|
-
fs.writeFile(outFileName, "Name: " + clean(post.name) + "\n\n" + clean(post.description), function (err) {
|
|
183
|
-
if (err) {
|
|
184
|
-
console.log(err);
|
|
185
|
-
}
|
|
186
|
-
innerSeriesCallback();
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
(innerSeriesCallback) => {
|
|
190
|
-
fs.writeFile(outFolderPath + "/points_for/" + post.id + "_post_points_for_" + (post.language ? post.language : "??") + ".txt", getPointsUp(post), function (err) {
|
|
191
|
-
if (err) {
|
|
192
|
-
console.log(err);
|
|
193
|
-
}
|
|
194
|
-
innerSeriesCallback();
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
(innerSeriesCallback) => {
|
|
198
|
-
fs.writeFile(outFolderPath + "/points_against/" + post.id + "_post_points_against_" + (post.language ? post.language : "??") + ".txt", getPointsDown(post), function (err) {
|
|
199
|
-
if (err) {
|
|
200
|
-
console.log(err);
|
|
201
|
-
}
|
|
202
|
-
innerSeriesCallback();
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
], () => {
|
|
206
|
-
seriesCallback();
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
seriesCallback();
|
|
211
|
-
}
|
|
212
|
-
}, function (error) {
|
|
213
|
-
async.series([
|
|
214
|
-
(innerSeriesCallback) => {
|
|
215
|
-
fs.writeFile(outFolderPath + "/all/all_posts.txt", outFilePostContent, function (err) {
|
|
216
|
-
if (err) {
|
|
217
|
-
console.log(err);
|
|
218
|
-
}
|
|
219
|
-
innerSeriesCallback();
|
|
220
|
-
});
|
|
221
|
-
},
|
|
222
|
-
(innerSeriesCallback) => {
|
|
223
|
-
fs.writeFile(outFolderPath + "/all/all_post_points_for.txt", outFilePointForContent, function (err) {
|
|
224
|
-
if (err) {
|
|
225
|
-
console.log(err);
|
|
226
|
-
}
|
|
227
|
-
innerSeriesCallback();
|
|
228
|
-
});
|
|
229
|
-
},
|
|
230
|
-
(innerSeriesCallback) => {
|
|
231
|
-
fs.writeFile(outFolderPath + "/all/all_post_points_against.txt", outFilePointAgainstContent, function (err) {
|
|
232
|
-
if (err) {
|
|
233
|
-
console.log(err);
|
|
234
|
-
}
|
|
235
|
-
innerSeriesCallback();
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
], () => {
|
|
239
|
-
console.log("Done");
|
|
240
|
-
process.exit();
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
export {};
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
var fs = require('fs');
|
|
5
|
-
var groupId = process.argv[2];
|
|
6
|
-
var urlPrefix = process.argv[3];
|
|
7
|
-
var outFile = process.argv[4];
|
|
8
|
-
var skipEmail = false;
|
|
9
|
-
var getPostUrl = function (post) {
|
|
10
|
-
if (urlPrefix) {
|
|
11
|
-
return urlPrefix + '/post/' + post.id;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return "https://yrpri.org/post/" + post.id;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var getUserEmail = function (post) {
|
|
18
|
-
if (skipEmail) {
|
|
19
|
-
return "hidden";
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return post.User.email;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var clean = function (text) {
|
|
26
|
-
//console.log("Before: "+ text);
|
|
27
|
-
var newText = text.replace('"', "'").replace('\n', '').replace('\r', '').replace(/(\r\n|\n|\r)/gm, "").replace(/"/gm, "'").replace(/,/, ';').trim();
|
|
28
|
-
//console.log("After:" + newText);
|
|
29
|
-
return newText.replace(/´/g, '');
|
|
30
|
-
};
|
|
31
|
-
var getLocation = function (post) {
|
|
32
|
-
if (post.location && post.location.latitude && post.location.longitude &&
|
|
33
|
-
post.location.latitude != "" && post.location.longitude != "") {
|
|
34
|
-
return post.location.latitude + ',' + post.location.longitude;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return '"",""';
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
var getPoints = function (points) {
|
|
41
|
-
var totalContent = "";
|
|
42
|
-
_.each(points, function (point) {
|
|
43
|
-
var content = clean(point.content) + "\n\n";
|
|
44
|
-
if (content.startsWith(",")) {
|
|
45
|
-
content = content.substr(1);
|
|
46
|
-
}
|
|
47
|
-
console.log("content: " + content);
|
|
48
|
-
totalContent += content;
|
|
49
|
-
});
|
|
50
|
-
return totalContent;
|
|
51
|
-
};
|
|
52
|
-
var getPointsUpOrDown = function (post, value) {
|
|
53
|
-
var pointsText = '"';
|
|
54
|
-
var points = _.filter(post.Points, function (point) {
|
|
55
|
-
if (value > 0) {
|
|
56
|
-
return point.value > 0;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return point.value < 0;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
pointsText += getPoints(points) + '"';
|
|
63
|
-
if (pointsText.startsWith(",")) {
|
|
64
|
-
pointsText = pointsText.substr(1);
|
|
65
|
-
}
|
|
66
|
-
console.log("PointText: " + pointsText);
|
|
67
|
-
return pointsText;
|
|
68
|
-
};
|
|
69
|
-
var getPointsUp = function (post) {
|
|
70
|
-
return getPointsUpOrDown(post, 1);
|
|
71
|
-
};
|
|
72
|
-
var getPointsDown = function (post) {
|
|
73
|
-
return getPointsUpOrDown(post, -1);
|
|
74
|
-
};
|
|
75
|
-
var getNewFromUsers = function (post) {
|
|
76
|
-
return "";
|
|
77
|
-
};
|
|
78
|
-
var getImageFormatUrl = function (image, formatId) {
|
|
79
|
-
var formats = JSON.parse(image.formats);
|
|
80
|
-
if (formats && formats.length > 0)
|
|
81
|
-
return formats[formatId];
|
|
82
|
-
else
|
|
83
|
-
return "";
|
|
84
|
-
};
|
|
85
|
-
var getImages = function (post) {
|
|
86
|
-
var imagesText = "";
|
|
87
|
-
if (post.PostHeaderImages && post.PostHeaderImages.length > 0) {
|
|
88
|
-
imagesText += _.map(post.PostHeaderImages, function (image) {
|
|
89
|
-
return "" + getImageFormatUrl(image, 0) + " ";
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (post.PostHeaderImages && post.PostUserImages.length > 0) {
|
|
93
|
-
imagesText += _.map(post.PostUserImages, function (image) {
|
|
94
|
-
return "" + getImageFormatUrl(image, 0) + " ";
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return imagesText;
|
|
98
|
-
};
|
|
99
|
-
var getCategory = function (post) {
|
|
100
|
-
if (post.Category) {
|
|
101
|
-
return post.Category.name;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
return "";
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
models.Post.unscoped().findAll({
|
|
108
|
-
where: {
|
|
109
|
-
group_id: groupId
|
|
110
|
-
},
|
|
111
|
-
order: [
|
|
112
|
-
['created_at', 'asc']
|
|
113
|
-
],
|
|
114
|
-
include: [
|
|
115
|
-
{
|
|
116
|
-
model: models.Category,
|
|
117
|
-
required: false
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
model: models.PostRevision,
|
|
121
|
-
required: false
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
model: models.Point,
|
|
125
|
-
attributes: ['id', 'content', 'value'],
|
|
126
|
-
required: false
|
|
127
|
-
},
|
|
128
|
-
{ model: models.Image,
|
|
129
|
-
as: 'PostHeaderImages',
|
|
130
|
-
required: false
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
model: models.User,
|
|
134
|
-
required: true
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
model: models.Image,
|
|
138
|
-
as: 'PostUserImages',
|
|
139
|
-
required: false,
|
|
140
|
-
where: {
|
|
141
|
-
deleted: false
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
}).then(function (posts) {
|
|
146
|
-
var outFileContent = "";
|
|
147
|
-
console.log(posts.length);
|
|
148
|
-
outFileContent += "Id, Post id,email,User Name,Post Name,Description,Url,Category,Latitude,Longitude,Up Votes,Down Votes,Points Count,Points For,Points Against,Images\n";
|
|
149
|
-
postCounter = 0;
|
|
150
|
-
async.eachSeries(posts, function (post, seriesCallback) {
|
|
151
|
-
postCounter += 1;
|
|
152
|
-
if (!post.deleted) {
|
|
153
|
-
outFileContent += postCounter + ',' + post.id + ',"' + getUserEmail(post) + '","' + post.User.name + '","' + clean(post.name) + '","' + clean(post.description) + '",' +
|
|
154
|
-
'"' + getPostUrl(post) + '",' + '"' + getCategory(post) + '",' +
|
|
155
|
-
getLocation(post) + ',' + post.counter_endorsements_up + ',' + post.counter_endorsements_down +
|
|
156
|
-
',' + post.counter_points + ',' + getPointsUp(post) + ',' + getPointsDown(post) + ',' +
|
|
157
|
-
getImages(post) + '\n';
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
outFileContent += postCounter + ',' + post.id + ',DELETED,,,,,,,,,,,\n';
|
|
161
|
-
}
|
|
162
|
-
seriesCallback();
|
|
163
|
-
}, function (error) {
|
|
164
|
-
fs.writeFile(outFile, outFileContent, function (err) {
|
|
165
|
-
if (err) {
|
|
166
|
-
console.log(err);
|
|
167
|
-
}
|
|
168
|
-
console.log("The file was saved!");
|
|
169
|
-
process.exit();
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const models = require('../models/index.cjs');
|
|
2
|
-
var postId = process.argv[2];
|
|
3
|
-
console.log(`Id,PostId,TypeIndex,Value`);
|
|
4
|
-
models.Rating.findAll({
|
|
5
|
-
where: {
|
|
6
|
-
post_id: postId
|
|
7
|
-
},
|
|
8
|
-
attributes: ['id', 'post_id', 'value', 'type_index']
|
|
9
|
-
}).then(ratings => {
|
|
10
|
-
ratings.forEach(rating => {
|
|
11
|
-
console.log(`${rating.id},${rating.post_id},${rating.type_index},${rating.value}`);
|
|
12
|
-
});
|
|
13
|
-
process.exit();
|
|
14
|
-
});
|
|
15
|
-
export {};
|