@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,16 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
console.log("Fix group");
|
|
4
|
-
models.Group.findAll({ where: { access: 1 } }).then(function (groups) {
|
|
5
|
-
async.eachSeries(groups, function (group, seriesCallback) {
|
|
6
|
-
group.access = models.Group.ACCESS_OPEN_TO_COMMUNITY;
|
|
7
|
-
group.save().then(function () {
|
|
8
|
-
console.log("Changed to open to community " + group.name);
|
|
9
|
-
seriesCallback();
|
|
10
|
-
});
|
|
11
|
-
}, function (error) {
|
|
12
|
-
console.log("Finished");
|
|
13
|
-
process.exit();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
var groupId = process.argv[2];
|
|
5
|
-
var postsCount = 0;
|
|
6
|
-
var pointsCount = 0;
|
|
7
|
-
async.series([
|
|
8
|
-
function (seriesCallback) {
|
|
9
|
-
models.Post.findAll({
|
|
10
|
-
where: {
|
|
11
|
-
group_id: groupId
|
|
12
|
-
}
|
|
13
|
-
}).then(function (posts) {
|
|
14
|
-
postsCount = posts.length;
|
|
15
|
-
seriesCallback();
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
function (seriesCallback) {
|
|
19
|
-
models.Point.findAll({
|
|
20
|
-
include: [
|
|
21
|
-
{
|
|
22
|
-
model: models.Post,
|
|
23
|
-
where: {
|
|
24
|
-
group_id: groupId
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}).then(function (posts) {
|
|
29
|
-
pointsCount = posts.length;
|
|
30
|
-
seriesCallback();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
], function (error) {
|
|
34
|
-
if (error) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
process.exit();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
models.Group.findOne({ where: { id: groupId } }).then(function (group) {
|
|
40
|
-
group.counter_posts = postsCount;
|
|
41
|
-
group.counter_points = pointsCount;
|
|
42
|
-
group.save().then(function () {
|
|
43
|
-
console.log("Have updated group");
|
|
44
|
-
process.exit();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
console.log("Fixing Notifications Settings");
|
|
4
|
-
var loopyloop = true;
|
|
5
|
-
var numberOfRows = 25000;
|
|
6
|
-
var offset = 0;
|
|
7
|
-
async.whilst(function () { return loopyloop; }, function (whilstCallback) {
|
|
8
|
-
models.User.findAll({
|
|
9
|
-
limit: numberOfRows,
|
|
10
|
-
offset: offset
|
|
11
|
-
}).then(function (users) {
|
|
12
|
-
if (users && users.length > 0) {
|
|
13
|
-
offset += numberOfRows;
|
|
14
|
-
async.eachSeries(users, function (user, seriesCallback) {
|
|
15
|
-
// console.log(user.email);
|
|
16
|
-
if (user.notifications_settings) {
|
|
17
|
-
user.set('notifications_settings.all_group.method', 0);
|
|
18
|
-
user.set('notifications_settings.all_community.method', 0);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
user.notifications_settings = models.AcNotification.defaultNotificationSettings;
|
|
22
|
-
}
|
|
23
|
-
user.save().then(function () {
|
|
24
|
-
seriesCallback();
|
|
25
|
-
});
|
|
26
|
-
}, function (error) {
|
|
27
|
-
console.log("Finished with rows continue");
|
|
28
|
-
whilstCallback();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.log("Finished with rows ENDING");
|
|
33
|
-
loopyloop = false;
|
|
34
|
-
whilstCallback();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}, function (err, n) {
|
|
38
|
-
});
|
|
39
|
-
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
var models = require("../models/index.cjs");
|
|
2
|
-
var async = require("async");
|
|
3
|
-
console.log("Fix group");
|
|
4
|
-
const groupId = process.argv[2];
|
|
5
|
-
const getSubCodeFromRadio = (radios, answer) => {
|
|
6
|
-
let subCode;
|
|
7
|
-
if (radios) {
|
|
8
|
-
for (let i = 0; i < radios.length; i++) {
|
|
9
|
-
//console.log(answer);
|
|
10
|
-
//console.log(`${radios[i].subCode.trim()} !`)
|
|
11
|
-
if (answer.startsWith(`${radios[i].subCode.trim()} `)) {
|
|
12
|
-
subCode = radios[i].subCode;
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return subCode;
|
|
18
|
-
};
|
|
19
|
-
const fixRadioDescriptionIfNeeded = (answers, questionsById, i) => {
|
|
20
|
-
let currentValue = answers[i].value;
|
|
21
|
-
console.log(currentValue);
|
|
22
|
-
const subCode = getSubCodeFromRadio(questionsById[answers[i].uniqueId].radioButtons, answers[i].value);
|
|
23
|
-
if (subCode) {
|
|
24
|
-
currentValue = currentValue.replace(`${subCode} `, '');
|
|
25
|
-
console.log(currentValue);
|
|
26
|
-
}
|
|
27
|
-
return currentValue;
|
|
28
|
-
};
|
|
29
|
-
const getAnswerType = (answers, questionsById, i) => {
|
|
30
|
-
return questionsById[answers[i].uniqueId].type;
|
|
31
|
-
};
|
|
32
|
-
const processPost = (group, post, done) => {
|
|
33
|
-
const questionsById = {};
|
|
34
|
-
const questionComponents = group.configuration.structuredQuestionsJson;
|
|
35
|
-
for (let i = 0; i < questionComponents.length; i++) {
|
|
36
|
-
questionsById[questionComponents[i].uniqueId] = questionComponents[i];
|
|
37
|
-
}
|
|
38
|
-
const answers = post.public_data.structuredAnswersJson;
|
|
39
|
-
for (let i = 0; i < answers.length; i += 1) {
|
|
40
|
-
if (answers[i] && answers[i].uniqueId && answers[i].value) {
|
|
41
|
-
const answerType = getAnswerType(answers, questionsById, i);
|
|
42
|
-
if (answers[i].value && answerType === "radios") {
|
|
43
|
-
answers[i].value = fixRadioDescriptionIfNeeded(answers, questionsById, i);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const clonedAnswers = [...answers];
|
|
48
|
-
post.set('public_data.structuredAnswersJson', clonedAnswers);
|
|
49
|
-
post.changed('public_data', true);
|
|
50
|
-
post.save().then(() => {
|
|
51
|
-
done();
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
models.Group.findOne({ where: { id: groupId } }).then((group) => {
|
|
55
|
-
models.Post.unscoped().findAll({ where: { group_id: groupId } }).then((posts) => {
|
|
56
|
-
async.eachSeries(posts, (post, seriesCallback) => {
|
|
57
|
-
processPost(group, post, seriesCallback);
|
|
58
|
-
}, function (error) {
|
|
59
|
-
console.log("Finished");
|
|
60
|
-
process.exit();
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const models = require('../models/index.cjs');
|
|
2
|
-
const async = require('async');
|
|
3
|
-
const moment = require('moment');
|
|
4
|
-
const domainId = process.argv[2];
|
|
5
|
-
const oldUserId = process.argv[3];
|
|
6
|
-
const newUserId = process.argv[4];
|
|
7
|
-
const beforeDate = process.argv[5];
|
|
8
|
-
console.log("Fix wrong user id on status updated");
|
|
9
|
-
if (!domainId || !oldUserId || !newUserId || !beforeDate) {
|
|
10
|
-
console.error("Missing parameters");
|
|
11
|
-
process.exit();
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
let beforeDateObject = moment(beforeDate);
|
|
15
|
-
models.User.findOne({
|
|
16
|
-
where: {
|
|
17
|
-
id: newUserId
|
|
18
|
-
}
|
|
19
|
-
}).then(function (newUser) {
|
|
20
|
-
if (newUser) {
|
|
21
|
-
models.AcActivity.findAll({
|
|
22
|
-
where: {
|
|
23
|
-
domain_id: domainId,
|
|
24
|
-
type: 'activity.post.status.change',
|
|
25
|
-
user_id: oldUserId,
|
|
26
|
-
created_at: {
|
|
27
|
-
$lt: beforeDateObject
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}).then(function (activities) {
|
|
31
|
-
async.eachSeries(activities, function (activity, innerCallback) {
|
|
32
|
-
activity.user_id = newUser.id;
|
|
33
|
-
activity.save().then(function (results) {
|
|
34
|
-
console.log('Adding admin user to missing status updates for activities ' + newUser.email);
|
|
35
|
-
innerCallback();
|
|
36
|
-
});
|
|
37
|
-
}, function (error) {
|
|
38
|
-
console.info("Completed");
|
|
39
|
-
process.exit();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
console.error("Missing user");
|
|
45
|
-
process.exit();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const models = require("../../models/index.cjs");
|
|
2
|
-
const _ = require("lodash");
|
|
3
|
-
const fs = require("fs").promises;
|
|
4
|
-
const groupId = process.argv[2];
|
|
5
|
-
const outFile = process.argv[3];
|
|
6
|
-
const clean = (text) => text
|
|
7
|
-
.replace(/["\n\r]/g, "")
|
|
8
|
-
.replace(/,/g, ";")
|
|
9
|
-
.replace(/´/g, "")
|
|
10
|
-
.trim();
|
|
11
|
-
const getYear = (post) => post.public_data &&
|
|
12
|
-
post.public_data.galleryMetaData &&
|
|
13
|
-
post.public_data.galleryMetaData.Upphafsar
|
|
14
|
-
? post.public_data.galleryMetaData.Upphafsar
|
|
15
|
-
: "";
|
|
16
|
-
const main = async () => {
|
|
17
|
-
const group = await models.Group.findByPk(groupId, { attributes: ["name"] });
|
|
18
|
-
const posts = await models.Post.unscoped().findAll({
|
|
19
|
-
where: { group_id: groupId },
|
|
20
|
-
order: [["counter_endorsements_up", "desc"]],
|
|
21
|
-
include: [{ model: models.User, required: true }],
|
|
22
|
-
});
|
|
23
|
-
let outFileContent = `"${group.name}"\n"Atkvæðafjöldi","Nafn listmanns","Heiti verks ísl.","Heiti verks en.","Ártal verks"\n`;
|
|
24
|
-
for (const post of posts) {
|
|
25
|
-
if (!post.deleted) {
|
|
26
|
-
outFileContent +=
|
|
27
|
-
`${post.counter_endorsements_up},"${clean(post.description)}","${clean(post.name)}",` + `"","${getYear(post)}"\n`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
await fs.writeFile(outFile, outFileContent);
|
|
32
|
-
console.log("The file was saved!");
|
|
33
|
-
process.exit();
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
console.log(err);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
main();
|
|
40
|
-
export {};
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
const models = require("../../models/index.cjs");
|
|
2
|
-
const moment = require("moment");
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const http = require("https");
|
|
6
|
-
const sizeOf = require("image-size");
|
|
7
|
-
const jsonPath = process.argv[2]; // "/home/robert/Downloads/finalMyndThin.json";
|
|
8
|
-
//TODO: Finna út úr að gera þetta frá URLI!
|
|
9
|
-
const imageFolderPath = "/home/robert/Downloads/myndlistinOkkar/myndir/MyndlistinOkkar2023V2/"; //process.argv[3];
|
|
10
|
-
//const groupId = 28478; //process.argv[4];
|
|
11
|
-
const userId = 850; //process.argv[5];
|
|
12
|
-
const groupIds = {
|
|
13
|
-
"Málverk - fyrir 1973": 28838,
|
|
14
|
-
"Málverk - eftir 1973": 28837,
|
|
15
|
-
"Málverk - án ártals": 28839,
|
|
16
|
-
"Þrívíð verk": 28840,
|
|
17
|
-
"Ljósmyndaverk": 28841,
|
|
18
|
-
"Önnur verk": 28843,
|
|
19
|
-
"Teikningar": 28844,
|
|
20
|
-
"Grafík": 28842,
|
|
21
|
-
};
|
|
22
|
-
LOCAL_TEST = false;
|
|
23
|
-
const urlbase = "https://yrpri-eu-direct-assets.s3.eu-west-1.amazonaws.com/MyndlistinOkkar2023V2/";
|
|
24
|
-
const createPost = async (groupId, groupName, name, description, imageFileName, imageFilePath, metaData) => {
|
|
25
|
-
return new Promise(async (resolve, reject) => {
|
|
26
|
-
try {
|
|
27
|
-
const imageUrl = urlbase + imageFileName;
|
|
28
|
-
let imageDimensions;
|
|
29
|
-
if (LOCAL_TEST) {
|
|
30
|
-
try {
|
|
31
|
-
imageDimensions = sizeOf(imageFilePath);
|
|
32
|
-
console.log(imageDimensions.width, imageDimensions.height);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
resolve();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
imageDimensions = { width: 1000, height: 1000 };
|
|
41
|
-
}
|
|
42
|
-
console.error(imageUrl);
|
|
43
|
-
const formats = JSON.stringify([imageUrl, imageUrl, imageUrl]);
|
|
44
|
-
const image = models.Image.build({
|
|
45
|
-
user_id: userId,
|
|
46
|
-
s3_bucket_name: process.env.S3_BUCKET || "fromScript",
|
|
47
|
-
original_filename: imageFileName,
|
|
48
|
-
formats,
|
|
49
|
-
user_agent: "Script",
|
|
50
|
-
ip_address: "127.0.0.1",
|
|
51
|
-
});
|
|
52
|
-
await image.save();
|
|
53
|
-
const post = models.Post.build({
|
|
54
|
-
user_id: userId,
|
|
55
|
-
group_id: groupId,
|
|
56
|
-
name,
|
|
57
|
-
description,
|
|
58
|
-
content: description,
|
|
59
|
-
status: "published",
|
|
60
|
-
user_agent: "Script",
|
|
61
|
-
ip_address: "127.0.0.1",
|
|
62
|
-
content_type: models.Post.CONTENT_IDEA,
|
|
63
|
-
});
|
|
64
|
-
post.set("public_data", {
|
|
65
|
-
galleryMetaData: metaData,
|
|
66
|
-
galleryImageData: {
|
|
67
|
-
width: imageDimensions.width,
|
|
68
|
-
height: imageDimensions.height,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
await post.save();
|
|
72
|
-
console.log(JSON.stringify(post));
|
|
73
|
-
await post.addPostHeaderImage(image);
|
|
74
|
-
resolve();
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
reject(error);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
// Empty anonymous function to avoid async/await error
|
|
82
|
-
(async () => {
|
|
83
|
-
if (LOCAL_TEST) {
|
|
84
|
-
fs.readFile(jsonPath, "utf8", async function (err, data) {
|
|
85
|
-
if (err)
|
|
86
|
-
throw err;
|
|
87
|
-
const obj = JSON.parse(data);
|
|
88
|
-
await downloadImages(obj);
|
|
89
|
-
process.exit();
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
// Load the JSON file with http request and then call the downloadImages function
|
|
94
|
-
const obj = await new Promise((resolve, reject) => {
|
|
95
|
-
http.get(jsonPath, (resp) => {
|
|
96
|
-
let data = "";
|
|
97
|
-
// A chunk of data has been received.
|
|
98
|
-
resp.on("data", (chunk) => {
|
|
99
|
-
data += chunk;
|
|
100
|
-
});
|
|
101
|
-
// The whole response has been received. Print out the result.
|
|
102
|
-
resp.on("end", () => {
|
|
103
|
-
resolve(JSON.parse(data));
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
await downloadImages(obj);
|
|
108
|
-
process.exit();
|
|
109
|
-
}
|
|
110
|
-
})();
|
|
111
|
-
async function downloadImages(obj) {
|
|
112
|
-
// Loop through the array of objects
|
|
113
|
-
const theData = obj.response.data;
|
|
114
|
-
for (let i = 0; i < theData.length; i++) {
|
|
115
|
-
// Get the image url
|
|
116
|
-
const imageUrl = theData[i].fieldData.Mynd;
|
|
117
|
-
const postDescription = theData[i].fieldData.ListamadurHofundur;
|
|
118
|
-
const postName = theData[i].fieldData.Verkheiti;
|
|
119
|
-
const year = theData[i].fieldData["Upphafsar"];
|
|
120
|
-
let groupName = theData[i].fieldData["Ljósmynd af"];
|
|
121
|
-
if (groupName == "Málverk") {
|
|
122
|
-
if (isNaN(year)) {
|
|
123
|
-
groupName = "Málverk - án ártals";
|
|
124
|
-
}
|
|
125
|
-
else if (year < 1973) {
|
|
126
|
-
groupName = "Málverk - fyrir 1973";
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
groupName = "Málverk - eftir 1973";
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const groupId = groupIds[groupName];
|
|
133
|
-
if (!groupId) {
|
|
134
|
-
console.error("No group found for: " + JSON.stringify(theData[i].fieldData));
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
const metaData = theData[i].fieldData;
|
|
138
|
-
//console.log(imageUrl);
|
|
139
|
-
if (imageUrl && imageUrl.startsWith("https://")) {
|
|
140
|
-
// Get the image name
|
|
141
|
-
//console.log(theData[i])
|
|
142
|
-
//console.log(imageUrl);
|
|
143
|
-
let imageName = imageUrl.split("/").pop().split("?")[0];
|
|
144
|
-
imageName = imageName.split("/").pop();
|
|
145
|
-
imageName = imageName.replace(/'/g, "");
|
|
146
|
-
//console.log(imageName);
|
|
147
|
-
// Download the image
|
|
148
|
-
//console.log(imageName, postName, postDescription, metaData)
|
|
149
|
-
//await download(imageUrl, imageName);
|
|
150
|
-
if (imageName.indexOf(".jpg") == -1) {
|
|
151
|
-
console.log("--------------------------------------");
|
|
152
|
-
console.log(postName);
|
|
153
|
-
console.log(postDescription);
|
|
154
|
-
console.error(imageName);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
await createPost(groupId, groupName, postName, postDescription, imageName, `${imageFolderPath}${imageName}`, metaData);
|
|
158
|
-
}
|
|
159
|
-
// change imageName to a random string from randomImages
|
|
160
|
-
//imageName = randomImages[Math.floor(Math.random() * randomImages.length)];
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
console.error("No valid image found for: " + JSON.stringify(theData[i].fieldData));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Read path to json and image folder from the command line
|
|
2
|
-
// Read json file and download images
|
|
3
|
-
// Usage: node readJsonAndDownloadImages.js <path to json file> <path to image folder>
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const http = require("https");
|
|
7
|
-
const jsonPath = process.argv[2];
|
|
8
|
-
const imageFolderPath = process.argv[3];
|
|
9
|
-
// Read and parse json file, use the callback function to download images
|
|
10
|
-
fs.readFile(jsonPath, "utf8", function (err, data) {
|
|
11
|
-
if (err)
|
|
12
|
-
throw err;
|
|
13
|
-
const obj = JSON.parse(data);
|
|
14
|
-
downloadImages(obj);
|
|
15
|
-
});
|
|
16
|
-
async function downloadImages(obj) {
|
|
17
|
-
// Loop through the array of objects
|
|
18
|
-
const theData = obj.response.data;
|
|
19
|
-
for (let i = 0; i < theData.length; i++) {
|
|
20
|
-
// Get the image url
|
|
21
|
-
const imageUrl = theData[i].fieldData.Mynd;
|
|
22
|
-
if (imageUrl && imageUrl.startsWith("https://")) {
|
|
23
|
-
// Get the image name
|
|
24
|
-
//console.log(theData[i])
|
|
25
|
-
//console.log(imageUrl);
|
|
26
|
-
let imageName = imageUrl.split("/").pop().split("?")[0];
|
|
27
|
-
imageName = imageName.split("/").pop();
|
|
28
|
-
imageName = imageName.replace(/'/g, "");
|
|
29
|
-
//console.log(imageName);
|
|
30
|
-
// Download the image
|
|
31
|
-
await download(imageUrl, imageName);
|
|
32
|
-
console.log(`"${imageName}",`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.error("No valid image found for: " + JSON.stringify(theData[i].fieldData));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Download and save the image from url using the http module
|
|
40
|
-
async function download(url, imageName) {
|
|
41
|
-
url = "https://www.citizens.is/wp-content/uploads/2020/01/cf-logo-small-final.jpg";
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
const file = fs.createWriteStream(`${imageFolderPath}/${imageName}`);
|
|
44
|
-
const request = http.get(url, function (response) {
|
|
45
|
-
response.pipe(file);
|
|
46
|
-
// after download completed close filestream
|
|
47
|
-
file.on("finish", () => {
|
|
48
|
-
file.close();
|
|
49
|
-
//console.log(`${imageName} downloaded`);
|
|
50
|
-
resolve();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const queue = require('../../active-citizen/workers/queue.cjs');
|
|
2
|
-
const models = require("../../models/index.cjs");
|
|
3
|
-
(async () => {
|
|
4
|
-
console.log("Start");
|
|
5
|
-
let offset = 0;
|
|
6
|
-
let count = 0;
|
|
7
|
-
let continueFetching = true;
|
|
8
|
-
const chunkSize = 100;
|
|
9
|
-
const communityId = process.argv[2];
|
|
10
|
-
const postsProcessed = {};
|
|
11
|
-
while (continueFetching) {
|
|
12
|
-
console.log(`Fetching posts ${offset} to ${offset + chunkSize - 1}...`);
|
|
13
|
-
const posts = await models.Post.findAll({
|
|
14
|
-
attributes: [
|
|
15
|
-
"id", "name"
|
|
16
|
-
],
|
|
17
|
-
include: [
|
|
18
|
-
{
|
|
19
|
-
model: models.Group,
|
|
20
|
-
attributes: ['id'],
|
|
21
|
-
include: [
|
|
22
|
-
{
|
|
23
|
-
model: models.Community,
|
|
24
|
-
attributes: ['id'],
|
|
25
|
-
where: {
|
|
26
|
-
id: process.argv[2]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
limit: chunkSize,
|
|
33
|
-
offset: offset
|
|
34
|
-
});
|
|
35
|
-
// Process the posts
|
|
36
|
-
for (let p = 0; p < posts.length; p++) {
|
|
37
|
-
console.log(`${posts[p].id} ${posts[p].name}`);
|
|
38
|
-
queue.add('process-similarities', { type: 'update-collection', postId: posts[p].id }, 'low');
|
|
39
|
-
await new Promise(resolve => setTimeout(resolve, 150));
|
|
40
|
-
count++;
|
|
41
|
-
if (postsProcessed[posts[p].id]) {
|
|
42
|
-
console.error(`Post ${posts[p].id} already processed!`);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
postsProcessed[posts[p].id] = true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Check if there are fewer posts than the chunk size, which indicates that it's the last chunk
|
|
49
|
-
if (posts.length < chunkSize) {
|
|
50
|
-
continueFetching = false;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
offset += chunkSize;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
console.log(`Done. Processed ${count} posts.`);
|
|
57
|
-
})();
|
|
58
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
var femalePostCount = 0;
|
|
4
|
-
var malePostCount = 0;
|
|
5
|
-
var unknownPostCount = 0;
|
|
6
|
-
var femalePointCount = 0;
|
|
7
|
-
var malePointCount = 0;
|
|
8
|
-
var unknownPointCount = 0;
|
|
9
|
-
var femaleEndorsementCount = 0;
|
|
10
|
-
var maleEndorsementCount = 0;
|
|
11
|
-
var unknownEndorsementCount = 0;
|
|
12
|
-
models.Domain.findOne({ where: { id: 1 } }).then(function (domain) {
|
|
13
|
-
domain.getDomainUsers().then(function (users) {
|
|
14
|
-
async.eachSeries(users, function (user, callback) {
|
|
15
|
-
models.Post.findAll({ where: { user_id: user.id } }).then(function (posts) {
|
|
16
|
-
if ((user.name.indexOf('dottir') > -1) || (user.name.indexOf('dóttir') > -1)) {
|
|
17
|
-
femalePostCount += posts.length;
|
|
18
|
-
}
|
|
19
|
-
else if ((user.name.indexOf('sson') > -1) || (user.name.indexOf('son') > -1)) {
|
|
20
|
-
malePostCount += posts.length;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
console.log(user.name);
|
|
24
|
-
unknownPostCount += posts.length;
|
|
25
|
-
}
|
|
26
|
-
models.Point.findAll({ where: { user_id: user.id } }).then(function (points) {
|
|
27
|
-
if ((user.name.indexOf('dottir') > -1) || (user.name.indexOf('dóttir') > -1)) {
|
|
28
|
-
femalePointCount += points.length;
|
|
29
|
-
}
|
|
30
|
-
else if ((user.name.indexOf('sson') > -1) || (user.name.indexOf('son') > -1)) {
|
|
31
|
-
malePointCount += points.length;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
unknownPointCount += points.length;
|
|
35
|
-
}
|
|
36
|
-
models.Endorsement.findAll({ where: { user_id: user.id } }).then(function (endorsements) {
|
|
37
|
-
if ((user.name.indexOf('dottir') > -1) || (user.name.indexOf('dóttir') > -1)) {
|
|
38
|
-
femaleEndorsementCount += endorsements.length;
|
|
39
|
-
}
|
|
40
|
-
else if ((user.name.indexOf('sson') > -1) || (user.name.indexOf('son') > -1)) {
|
|
41
|
-
maleEndorsementCount += endorsements.length;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
unknownEndorsementCount += endorsements.length;
|
|
45
|
-
}
|
|
46
|
-
callback();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}, function done() {
|
|
51
|
-
console.log("femalePostCount: " + femalePostCount);
|
|
52
|
-
console.log("malePostCount: " + malePostCount);
|
|
53
|
-
console.log("unknownPostCount: " + unknownPostCount);
|
|
54
|
-
console.log("femalePointCount: " + femalePointCount);
|
|
55
|
-
console.log("malePointCount: " + malePointCount);
|
|
56
|
-
console.log("unknownPointCount: " + unknownPointCount);
|
|
57
|
-
console.log("femaleEndorsementCount: " + femaleEndorsementCount);
|
|
58
|
-
console.log("maleEndorsementCount: " + maleEndorsementCount);
|
|
59
|
-
console.log("unknownEndorsementCount: " + unknownEndorsementCount);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var models = require('../models/index.cjs');
|
|
2
|
-
var async = require('async');
|
|
3
|
-
var femalePostCount = 0;
|
|
4
|
-
var malePostCount = 0;
|
|
5
|
-
var unknownPostCount = 0;
|
|
6
|
-
var translateOfficialStatus = function (status) {
|
|
7
|
-
if (status == [0]) {
|
|
8
|
-
return "Open";
|
|
9
|
-
}
|
|
10
|
-
else if (status == [-2]) {
|
|
11
|
-
return "Failed";
|
|
12
|
-
}
|
|
13
|
-
else if (status == [-1, 1]) {
|
|
14
|
-
return "InProgress";
|
|
15
|
-
}
|
|
16
|
-
else if (status == [2]) {
|
|
17
|
-
return "Successful";
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
models.Domain.findOne({ where: { id: 1 } }).then(function (domain) {
|
|
21
|
-
domain.getDomainUsers().then(function (users) {
|
|
22
|
-
async.eachSeries([[0], [-2], [-1, 1], [2]], function (officialStatus, outerSeriesCallback) {
|
|
23
|
-
async.eachSeries(users, function (user, callback) {
|
|
24
|
-
async.series([
|
|
25
|
-
function (innerCallback) {
|
|
26
|
-
models.Post.findAll({
|
|
27
|
-
where: {
|
|
28
|
-
user_id: user.id,
|
|
29
|
-
official_status: {
|
|
30
|
-
$in: officialStatus
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}).then(function (posts) {
|
|
34
|
-
if ((user.name.indexOf('dottir') > -1) || (user.name.indexOf('dóttir') > -1)) {
|
|
35
|
-
femalePostCount += posts.length;
|
|
36
|
-
}
|
|
37
|
-
else if ((user.name.indexOf('sson') > -1) || (user.name.indexOf('son') > -1)) {
|
|
38
|
-
malePostCount += posts.length;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
unknownPostCount += posts.length;
|
|
42
|
-
}
|
|
43
|
-
innerCallback();
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
], function () {
|
|
47
|
-
callback();
|
|
48
|
-
});
|
|
49
|
-
}, function () {
|
|
50
|
-
console.log("Ideas " + translateOfficialStatus(officialStatus));
|
|
51
|
-
console.log("femalePostCount: " + femalePostCount);
|
|
52
|
-
console.log("malePostCount: " + malePostCount);
|
|
53
|
-
console.log("unknownPostCount: " + unknownPostCount);
|
|
54
|
-
femalePostCount = 0;
|
|
55
|
-
malePostCount = 0;
|
|
56
|
-
unknownPostCount = 0;
|
|
57
|
-
outerSeriesCallback();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
export {};
|