@bonifaceebuka/core-backend 1.0.0
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/Readme.md +33 -0
- package/dist/app.js +59 -0
- package/dist/common/configs/axios.d.ts +7 -0
- package/dist/common/configs/axios.d.ts.map +1 -0
- package/dist/common/configs/axios.js +26 -0
- package/dist/common/configs/cloudinary.d.ts +3 -0
- package/dist/common/configs/cloudinary.d.ts.map +1 -0
- package/dist/common/configs/cloudinary.js +10 -0
- package/dist/common/configs/cors.d.ts +8 -0
- package/dist/common/configs/cors.d.ts.map +1 -0
- package/dist/common/configs/cors.js +23 -0
- package/dist/common/configs/express.js +29 -0
- package/dist/common/configs/index.d.ts +111 -0
- package/dist/common/configs/index.d.ts.map +1 -0
- package/dist/common/configs/index.js +168 -0
- package/dist/common/configs/logger.d.ts +3 -0
- package/dist/common/configs/logger.d.ts.map +1 -0
- package/dist/common/configs/logger.js +66 -0
- package/dist/common/configs/mailing.d.ts +4 -0
- package/dist/common/configs/mailing.d.ts.map +1 -0
- package/dist/common/configs/mailing.js +22 -0
- package/dist/common/configs/plans.d.ts +15 -0
- package/dist/common/configs/plans.d.ts.map +1 -0
- package/dist/common/configs/plans.js +17 -0
- package/dist/common/configs/postgres.d.ts +4 -0
- package/dist/common/configs/postgres.d.ts.map +1 -0
- package/dist/common/configs/postgres.js +25 -0
- package/dist/common/configs/redis.d.ts +5 -0
- package/dist/common/configs/redis.d.ts.map +1 -0
- package/dist/common/configs/redis.js +78 -0
- package/dist/common/configs/sendgrid.d.ts +3 -0
- package/dist/common/configs/sendgrid.d.ts.map +1 -0
- package/dist/common/configs/sendgrid.js +21 -0
- package/dist/common/configs/websocket.js +17 -0
- package/dist/common/constants/chat.d.ts +18 -0
- package/dist/common/constants/chat.d.ts.map +1 -0
- package/dist/common/constants/chat.js +20 -0
- package/dist/common/constants/messages/admin.messages.d.ts +33 -0
- package/dist/common/constants/messages/admin.messages.d.ts.map +1 -0
- package/dist/common/constants/messages/admin.messages.js +35 -0
- package/dist/common/constants/messages/index.d.ts +19 -0
- package/dist/common/constants/messages/index.d.ts.map +1 -0
- package/dist/common/constants/messages/index.js +21 -0
- package/dist/common/constants/messages/user.messages.d.ts +33 -0
- package/dist/common/constants/messages/user.messages.d.ts.map +1 -0
- package/dist/common/constants/messages/user.messages.js +35 -0
- package/dist/common/dtos/AdminDto.d.ts +5 -0
- package/dist/common/dtos/AdminDto.d.ts.map +1 -0
- package/dist/common/dtos/AdminDto.js +30 -0
- package/dist/common/dtos/ArticleDto.d.ts +11 -0
- package/dist/common/dtos/ArticleDto.d.ts.map +1 -0
- package/dist/common/dtos/ArticleDto.js +61 -0
- package/dist/common/dtos/BusinessDto.d.ts +12 -0
- package/dist/common/dtos/BusinessDto.d.ts.map +1 -0
- package/dist/common/dtos/BusinessDto.js +59 -0
- package/dist/common/dtos/ChatDto.d.ts +17 -0
- package/dist/common/dtos/ChatDto.d.ts.map +1 -0
- package/dist/common/dtos/ChatDto.js +89 -0
- package/dist/common/dtos/CommonDto.d.ts +13 -0
- package/dist/common/dtos/CommonDto.d.ts.map +1 -0
- package/dist/common/dtos/CommonDto.js +59 -0
- package/dist/common/dtos/CommunityDto.d.ts +10 -0
- package/dist/common/dtos/CommunityDto.d.ts.map +1 -0
- package/dist/common/dtos/CommunityDto.js +72 -0
- package/dist/common/dtos/EventDto.d.ts +24 -0
- package/dist/common/dtos/EventDto.d.ts.map +1 -0
- package/dist/common/dtos/EventDto.js +72 -0
- package/dist/common/dtos/IPaginator.d.ts +15 -0
- package/dist/common/dtos/IPaginator.d.ts.map +1 -0
- package/dist/common/dtos/IPaginator.js +40 -0
- package/dist/common/dtos/Paginator.d.ts +15 -0
- package/dist/common/dtos/Paginator.d.ts.map +1 -0
- package/dist/common/dtos/Paginator.js +40 -0
- package/dist/common/dtos/Plan.dto.d.ts +10 -0
- package/dist/common/dtos/Plan.dto.d.ts.map +1 -0
- package/dist/common/dtos/Plan.dto.js +66 -0
- package/dist/common/dtos/PostDto.d.ts +13 -0
- package/dist/common/dtos/PostDto.d.ts.map +1 -0
- package/dist/common/dtos/PostDto.js +75 -0
- package/dist/common/dtos/ProductDto.d.ts +13 -0
- package/dist/common/dtos/ProductDto.d.ts.map +1 -0
- package/dist/common/dtos/ProductDto.js +66 -0
- package/dist/common/dtos/ServiceDto.d.ts +19 -0
- package/dist/common/dtos/ServiceDto.d.ts.map +1 -0
- package/dist/common/dtos/ServiceDto.js +93 -0
- package/dist/common/dtos/UserDto.d.ts +70 -0
- package/dist/common/dtos/UserDto.d.ts.map +1 -0
- package/dist/common/dtos/UserDto.js +313 -0
- package/dist/common/enums/ChatEnum.d.ts +6 -0
- package/dist/common/enums/ChatEnum.d.ts.map +1 -0
- package/dist/common/enums/ChatEnum.js +9 -0
- package/dist/common/enums/CommunityEnum.d.ts +14 -0
- package/dist/common/enums/CommunityEnum.d.ts.map +1 -0
- package/dist/common/enums/CommunityEnum.js +19 -0
- package/dist/common/enums/ConnectionEnum.d.ts +11 -0
- package/dist/common/enums/ConnectionEnum.d.ts.map +1 -0
- package/dist/common/enums/ConnectionEnum.js +15 -0
- package/dist/common/enums/EventEnum.d.ts +7 -0
- package/dist/common/enums/EventEnum.d.ts.map +1 -0
- package/dist/common/enums/EventEnum.js +10 -0
- package/dist/common/enums/IndexEnum.d.ts +56 -0
- package/dist/common/enums/IndexEnum.d.ts.map +1 -0
- package/dist/common/enums/IndexEnum.js +67 -0
- package/dist/common/enums/MarketplaceEnum.d.ts +9 -0
- package/dist/common/enums/MarketplaceEnum.d.ts.map +1 -0
- package/dist/common/enums/MarketplaceEnum.js +13 -0
- package/dist/common/enums/NotificationEnum.d.ts +7 -0
- package/dist/common/enums/NotificationEnum.d.ts.map +1 -0
- package/dist/common/enums/NotificationEnum.js +10 -0
- package/dist/common/enums/TransactionEnum.d.ts +9 -0
- package/dist/common/enums/TransactionEnum.d.ts.map +1 -0
- package/dist/common/enums/TransactionEnum.js +13 -0
- package/dist/common/enums/UploadEnum.d.ts +15 -0
- package/dist/common/enums/UploadEnum.d.ts.map +1 -0
- package/dist/common/enums/UploadEnum.js +19 -0
- package/dist/common/enums/UserEnums.d.ts +36 -0
- package/dist/common/enums/UserEnums.d.ts.map +1 -0
- package/dist/common/enums/UserEnums.js +44 -0
- package/dist/common/enums/index.d.ts +65 -0
- package/dist/common/enums/index.d.ts.map +1 -0
- package/dist/common/enums/index.js +90 -0
- package/dist/common/errors/AppError.d.ts +6 -0
- package/dist/common/errors/AppError.d.ts.map +1 -0
- package/dist/common/errors/AppError.js +14 -0
- package/dist/common/types/HttpType.d.ts +11 -0
- package/dist/common/types/HttpType.d.ts.map +1 -0
- package/dist/common/types/HttpType.js +47 -0
- package/dist/common/types/IPagination.d.ts +15 -0
- package/dist/common/types/IPagination.d.ts.map +1 -0
- package/dist/common/types/IPagination.js +2 -0
- package/dist/common/types/Isocket.d.ts +6 -0
- package/dist/common/types/Isocket.d.ts.map +1 -0
- package/dist/common/types/Isocket.js +2 -0
- package/dist/common/types/chatType.d.ts +36 -0
- package/dist/common/types/chatType.d.ts.map +1 -0
- package/dist/common/types/chatType.js +2 -0
- package/dist/common/types/index.d.ts +6 -0
- package/dist/common/types/index.d.ts.map +1 -0
- package/dist/common/types/index.js +21 -0
- package/dist/common/types/mail.d.ts +7 -0
- package/dist/common/types/mail.d.ts.map +1 -0
- package/dist/common/types/mail.js +2 -0
- package/dist/common/types/uploadsType.d.ts +14 -0
- package/dist/common/types/uploadsType.d.ts.map +1 -0
- package/dist/common/types/uploadsType.js +45 -0
- package/dist/common/utils/axios.js +26 -0
- package/dist/common/utils/index.d.ts +28 -0
- package/dist/common/utils/index.d.ts.map +1 -0
- package/dist/common/utils/index.js +159 -0
- package/dist/common/utils/mailing.d.ts +2 -0
- package/dist/common/utils/mailing.d.ts.map +1 -0
- package/dist/common/utils/mailing.js +76 -0
- package/dist/common/utils/number_utils.d.ts +3 -0
- package/dist/common/utils/number_utils.d.ts.map +1 -0
- package/dist/common/utils/number_utils.js +10 -0
- package/dist/common/utils/responseHandlers.d.ts +44 -0
- package/dist/common/utils/responseHandlers.d.ts.map +1 -0
- package/dist/common/utils/responseHandlers.js +49 -0
- package/dist/common/utils/security.d.ts +7 -0
- package/dist/common/utils/security.d.ts.map +1 -0
- package/dist/common/utils/security.js +44 -0
- package/dist/common/utils/socket.js +16 -0
- package/dist/common/utils/validator.d.ts +6 -0
- package/dist/common/utils/validator.d.ts.map +1 -0
- package/dist/common/utils/validator.js +43 -0
- package/dist/database/migrations/1765969273227-create-base-migrations.d.ts +7 -0
- package/dist/database/migrations/1765969273227-create-base-migrations.d.ts.map +1 -0
- package/dist/database/migrations/1765969273227-create-base-migrations.js +53 -0
- package/dist/database/migrations/1765981653813-modify-users-table.d.ts +7 -0
- package/dist/database/migrations/1765981653813-modify-users-table.d.ts.map +1 -0
- package/dist/database/migrations/1765981653813-modify-users-table.js +19 -0
- package/dist/database/migrations/1766478443902-create_step_one_form_data_tables.d.ts +7 -0
- package/dist/database/migrations/1766478443902-create_step_one_form_data_tables.d.ts.map +1 -0
- package/dist/database/migrations/1766478443902-create_step_one_form_data_tables.js +79 -0
- package/dist/database/migrations/1766482587930-create_speeches_table.d.ts +7 -0
- package/dist/database/migrations/1766482587930-create_speeches_table.d.ts.map +1 -0
- package/dist/database/migrations/1766482587930-create_speeches_table.js +91 -0
- package/dist/database/migrations/1766486689085-create_challenges_and_education_table.d.ts +7 -0
- package/dist/database/migrations/1766486689085-create_challenges_and_education_table.d.ts.map +1 -0
- package/dist/database/migrations/1766486689085-create_challenges_and_education_table.js +21 -0
- package/dist/database/migrations/1766488441761-create_goals_table.d.ts +7 -0
- package/dist/database/migrations/1766488441761-create_goals_table.d.ts.map +1 -0
- package/dist/database/migrations/1766488441761-create_goals_table.js +13 -0
- package/dist/database/migrations/1766596709454-events_related_tables.d.ts +7 -0
- package/dist/database/migrations/1766596709454-events_related_tables.d.ts.map +1 -0
- package/dist/database/migrations/1766596709454-events_related_tables.js +27 -0
- package/dist/database/migrations/1767290352669-changed_country_to_location_events_table.d.ts +7 -0
- package/dist/database/migrations/1767290352669-changed_country_to_location_events_table.d.ts.map +1 -0
- package/dist/database/migrations/1767290352669-changed_country_to_location_events_table.js +47 -0
- package/dist/database/migrations/1767290877959-indexed_users_table.d.ts +7 -0
- package/dist/database/migrations/1767290877959-indexed_users_table.d.ts.map +1 -0
- package/dist/database/migrations/1767290877959-indexed_users_table.js +13 -0
- package/dist/database/migrations/1767291527448-indexed_tables.d.ts +7 -0
- package/dist/database/migrations/1767291527448-indexed_tables.d.ts.map +1 -0
- package/dist/database/migrations/1767291527448-indexed_tables.js +71 -0
- package/dist/database/migrations/1767292081954-added_event_venue_column_to_events_table.d.ts +7 -0
- package/dist/database/migrations/1767292081954-added_event_venue_column_to_events_table.d.ts.map +1 -0
- package/dist/database/migrations/1767292081954-added_event_venue_column_to_events_table.js +13 -0
- package/dist/database/migrations/1767369618268-create_billings_related_table.d.ts +7 -0
- package/dist/database/migrations/1767369618268-create_billings_related_table.d.ts.map +1 -0
- package/dist/database/migrations/1767369618268-create_billings_related_table.js +45 -0
- package/dist/database/migrations/1767404043438-create_billings_related_tables.d.ts +7 -0
- package/dist/database/migrations/1767404043438-create_billings_related_tables.d.ts.map +1 -0
- package/dist/database/migrations/1767404043438-create_billings_related_tables.js +19 -0
- package/dist/database/migrations/1767617739297-update_tables.d.ts +7 -0
- package/dist/database/migrations/1767617739297-update_tables.d.ts.map +1 -0
- package/dist/database/migrations/1767617739297-update_tables.js +27 -0
- package/dist/database/migrations/1767717097064-create_event_attendance_table.d.ts +7 -0
- package/dist/database/migrations/1767717097064-create_event_attendance_table.d.ts.map +1 -0
- package/dist/database/migrations/1767717097064-create_event_attendance_table.js +40 -0
- package/dist/database/migrations/1767792070012-added_more_fields_to_users_table.d.ts +7 -0
- package/dist/database/migrations/1767792070012-added_more_fields_to_users_table.d.ts.map +1 -0
- package/dist/database/migrations/1767792070012-added_more_fields_to_users_table.js +17 -0
- package/dist/database/migrations/1767878654013-added_more_fields_to_users_table.d.ts +7 -0
- package/dist/database/migrations/1767878654013-added_more_fields_to_users_table.d.ts.map +1 -0
- package/dist/database/migrations/1767878654013-added_more_fields_to_users_table.js +15 -0
- package/dist/database/migrations/1767882191474-added_more_fields_to_events_table.d.ts +7 -0
- package/dist/database/migrations/1767882191474-added_more_fields_to_events_table.d.ts.map +1 -0
- package/dist/database/migrations/1767882191474-added_more_fields_to_events_table.js +17 -0
- package/dist/database/migrations/1767883990258-added_coordinates_field_to_events_table.d.ts +7 -0
- package/dist/database/migrations/1767883990258-added_coordinates_field_to_events_table.d.ts.map +1 -0
- package/dist/database/migrations/1767883990258-added_coordinates_field_to_events_table.js +19 -0
- package/dist/database/migrations/1767890415337-added_coordinates_field_to_user_profiles_table.d.ts +7 -0
- package/dist/database/migrations/1767890415337-added_coordinates_field_to_user_profiles_table.d.ts.map +1 -0
- package/dist/database/migrations/1767890415337-added_coordinates_field_to_user_profiles_table.js +15 -0
- package/dist/database/migrations/1767891781321-create_location_gist_index.d.ts +6 -0
- package/dist/database/migrations/1767891781321-create_location_gist_index.d.ts.map +1 -0
- package/dist/database/migrations/1767891781321-create_location_gist_index.js +26 -0
- package/dist/database/migrations/1768486598835-create_comunity_creation_tables.d.ts +7 -0
- package/dist/database/migrations/1768486598835-create_comunity_creation_tables.d.ts.map +1 -0
- package/dist/database/migrations/1768486598835-create_comunity_creation_tables.js +47 -0
- package/dist/database/migrations/1768489253067-create_comunity_creation_tables.d.ts +7 -0
- package/dist/database/migrations/1768489253067-create_comunity_creation_tables.d.ts.map +1 -0
- package/dist/database/migrations/1768489253067-create_comunity_creation_tables.js +19 -0
- package/dist/database/migrations/1768713527323-create_posts_table.d.ts +7 -0
- package/dist/database/migrations/1768713527323-create_posts_table.d.ts.map +1 -0
- package/dist/database/migrations/1768713527323-create_posts_table.js +29 -0
- package/dist/database/migrations/1768888281914-create_post_comments_table.d.ts +7 -0
- package/dist/database/migrations/1768888281914-create_post_comments_table.d.ts.map +1 -0
- package/dist/database/migrations/1768888281914-create_post_comments_table.js +45 -0
- package/dist/database/migrations/1768897962516-tightened_the_likable_type_field_in_likes_table.d.ts +7 -0
- package/dist/database/migrations/1768897962516-tightened_the_likable_type_field_in_likes_table.d.ts.map +1 -0
- package/dist/database/migrations/1768897962516-tightened_the_likable_type_field_in_likes_table.js +21 -0
- package/dist/database/migrations/1769721210774-create_products_table.d.ts +7 -0
- package/dist/database/migrations/1769721210774-create_products_table.d.ts.map +1 -0
- package/dist/database/migrations/1769721210774-create_products_table.js +97 -0
- package/dist/database/migrations/1769728749602-modified_products_table.d.ts +7 -0
- package/dist/database/migrations/1769728749602-modified_products_table.d.ts.map +1 -0
- package/dist/database/migrations/1769728749602-modified_products_table.js +13 -0
- package/dist/database/migrations/1769852101831-create_businesses_table.d.ts +7 -0
- package/dist/database/migrations/1769852101831-create_businesses_table.d.ts.map +1 -0
- package/dist/database/migrations/1769852101831-create_businesses_table.js +35 -0
- package/dist/database/migrations/1769854726115-modified_businesses_table.d.ts +7 -0
- package/dist/database/migrations/1769854726115-modified_businesses_table.d.ts.map +1 -0
- package/dist/database/migrations/1769854726115-modified_businesses_table.js +17 -0
- package/dist/database/migrations/1770059807138-nullified_title_posts_table.d.ts +7 -0
- package/dist/database/migrations/1770059807138-nullified_title_posts_table.d.ts.map +1 -0
- package/dist/database/migrations/1770059807138-nullified_title_posts_table.js +25 -0
- package/dist/database/migrations/1770108116282-added_business_id_products_table.d.ts +7 -0
- package/dist/database/migrations/1770108116282-added_business_id_products_table.d.ts.map +1 -0
- package/dist/database/migrations/1770108116282-added_business_id_products_table.js +15 -0
- package/dist/database/migrations/1770145991793-create_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770145991793-create_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770145991793-create_service_providers_table.js +39 -0
- package/dist/database/migrations/1770202856432-modified_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770202856432-modified_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770202856432-modified_service_providers_table.js +23 -0
- package/dist/database/migrations/1770203361907-modified_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770203361907-modified_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770203361907-modified_service_providers_table.js +15 -0
- package/dist/database/migrations/1770221489298-modified_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770221489298-modified_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770221489298-modified_service_providers_table.js +15 -0
- package/dist/database/migrations/1770234277025-added_category_id_to_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770234277025-added_category_id_to_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770234277025-added_category_id_to_service_providers_table.js +15 -0
- package/dist/database/migrations/1770235034364-added_category_id_to_service_providers_table.d.ts +7 -0
- package/dist/database/migrations/1770235034364-added_category_id_to_service_providers_table.d.ts.map +1 -0
- package/dist/database/migrations/1770235034364-added_category_id_to_service_providers_table.js +17 -0
- package/dist/database/migrations/1770459229926-create_articles_table.d.ts +7 -0
- package/dist/database/migrations/1770459229926-create_articles_table.d.ts.map +1 -0
- package/dist/database/migrations/1770459229926-create_articles_table.js +61 -0
- package/dist/database/migrations/1770544472943-modified_users_table.d.ts +7 -0
- package/dist/database/migrations/1770544472943-modified_users_table.d.ts.map +1 -0
- package/dist/database/migrations/1770544472943-modified_users_table.js +15 -0
- package/dist/database/migrations/1770556066865-create_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770556066865-create_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770556066865-create_chats_table.js +37 -0
- package/dist/database/migrations/1770557237871-modified_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770557237871-modified_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770557237871-modified_chats_table.js +21 -0
- package/dist/database/migrations/1770559802657-modified_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770559802657-modified_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770559802657-modified_chats_table.js +27 -0
- package/dist/database/migrations/1770570310226-modified_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770570310226-modified_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770570310226-modified_chats_table.js +29 -0
- package/dist/database/migrations/1770574652097-modified_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770574652097-modified_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770574652097-modified_chats_table.js +31 -0
- package/dist/database/migrations/1770728516930-modified_chats_table.d.ts +7 -0
- package/dist/database/migrations/1770728516930-modified_chats_table.d.ts.map +1 -0
- package/dist/database/migrations/1770728516930-modified_chats_table.js +23 -0
- package/dist/database/seeds/CommunityDataSeeder.js +48 -0
- package/dist/database/seeds/EventDataSeeder.js +54 -0
- package/dist/database/seeds/FeatureSeeder.js +131 -0
- package/dist/database/seeds/MarketplaceDataSeeder.js +95 -0
- package/dist/database/seeds/PlanSeeder.js +78 -0
- package/dist/database/seeds/UserProfileDataSeeder.js +215 -0
- package/dist/database/seeds/index.js +39 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/ioc.d.ts +6 -0
- package/dist/ioc.d.ts.map +1 -0
- package/dist/ioc.js +9 -0
- package/dist/models/AdminUserModel.d.ts +18 -0
- package/dist/models/AdminUserModel.d.ts.map +1 -0
- package/dist/models/AdminUserModel.js +92 -0
- package/dist/models/ArticleCommentModel.d.ts +14 -0
- package/dist/models/ArticleCommentModel.d.ts.map +1 -0
- package/dist/models/ArticleCommentModel.js +69 -0
- package/dist/models/ArticleImageModel.d.ts +10 -0
- package/dist/models/ArticleImageModel.d.ts.map +1 -0
- package/dist/models/ArticleImageModel.js +45 -0
- package/dist/models/ArticleModel.d.ts +16 -0
- package/dist/models/ArticleModel.d.ts.map +1 -0
- package/dist/models/ArticleModel.js +70 -0
- package/dist/models/BaseModel.d.ts +8 -0
- package/dist/models/BaseModel.d.ts.map +1 -0
- package/dist/models/BaseModel.js +43 -0
- package/dist/models/BookmarkModel.d.ts +8 -0
- package/dist/models/BookmarkModel.d.ts.map +1 -0
- package/dist/models/BookmarkModel.js +40 -0
- package/dist/models/BusinessCategoryModel.d.ts +5 -0
- package/dist/models/BusinessCategoryModel.d.ts.map +1 -0
- package/dist/models/BusinessCategoryModel.js +25 -0
- package/dist/models/BusinessIdCategoryModel.d.ts +5 -0
- package/dist/models/BusinessIdCategoryModel.d.ts.map +1 -0
- package/dist/models/BusinessIdCategoryModel.js +25 -0
- package/dist/models/BusinessModel.d.ts +22 -0
- package/dist/models/BusinessModel.d.ts.map +1 -0
- package/dist/models/BusinessModel.js +103 -0
- package/dist/models/BusinessServiceModel.d.ts +12 -0
- package/dist/models/BusinessServiceModel.d.ts.map +1 -0
- package/dist/models/BusinessServiceModel.js +54 -0
- package/dist/models/CardModel.d.ts +19 -0
- package/dist/models/CardModel.d.ts.map +1 -0
- package/dist/models/CardModel.js +91 -0
- package/dist/models/CategoryModel.d.ts +5 -0
- package/dist/models/CategoryModel.d.ts.map +1 -0
- package/dist/models/CategoryModel.js +25 -0
- package/dist/models/ChallengeModel.d.ts +6 -0
- package/dist/models/ChallengeModel.d.ts.map +1 -0
- package/dist/models/ChallengeModel.js +30 -0
- package/dist/models/ChatMessageModel.d.ts +16 -0
- package/dist/models/ChatMessageModel.d.ts.map +1 -0
- package/dist/models/ChatMessageModel.js +75 -0
- package/dist/models/CommentModel.d.ts +14 -0
- package/dist/models/CommentModel.d.ts.map +1 -0
- package/dist/models/CommentModel.js +69 -0
- package/dist/models/CommunityMemberModel.d.ts +12 -0
- package/dist/models/CommunityMemberModel.d.ts.map +1 -0
- package/dist/models/CommunityMemberModel.js +55 -0
- package/dist/models/CommunityModel.d.ts +22 -0
- package/dist/models/CommunityModel.d.ts.map +1 -0
- package/dist/models/CommunityModel.js +97 -0
- package/dist/models/CommunityTopicModel.d.ts +10 -0
- package/dist/models/CommunityTopicModel.d.ts.map +1 -0
- package/dist/models/CommunityTopicModel.js +45 -0
- package/dist/models/ConnectionModel.d.ts +11 -0
- package/dist/models/ConnectionModel.d.ts.map +1 -0
- package/dist/models/ConnectionModel.js +53 -0
- package/dist/models/ConversationModel.d.ts +8 -0
- package/dist/models/ConversationModel.d.ts.map +1 -0
- package/dist/models/ConversationModel.js +43 -0
- package/dist/models/DiagnosisLevelModel.d.ts +7 -0
- package/dist/models/DiagnosisLevelModel.d.ts.map +1 -0
- package/dist/models/DiagnosisLevelModel.js +32 -0
- package/dist/models/EducationModel.d.ts +5 -0
- package/dist/models/EducationModel.d.ts.map +1 -0
- package/dist/models/EducationModel.js +25 -0
- package/dist/models/EventAttendanceModel.d.ts +10 -0
- package/dist/models/EventAttendanceModel.d.ts.map +1 -0
- package/dist/models/EventAttendanceModel.js +45 -0
- package/dist/models/EventModel.d.ts +25 -0
- package/dist/models/EventModel.d.ts.map +1 -0
- package/dist/models/EventModel.js +119 -0
- package/dist/models/EventTypeModel.d.ts +7 -0
- package/dist/models/EventTypeModel.d.ts.map +1 -0
- package/dist/models/EventTypeModel.js +31 -0
- package/dist/models/FeatureModel.d.ts +9 -0
- package/dist/models/FeatureModel.d.ts.map +1 -0
- package/dist/models/FeatureModel.js +50 -0
- package/dist/models/GoalModel.d.ts +5 -0
- package/dist/models/GoalModel.d.ts.map +1 -0
- package/dist/models/GoalModel.js +25 -0
- package/dist/models/InterestModel.d.ts +7 -0
- package/dist/models/InterestModel.d.ts.map +1 -0
- package/dist/models/InterestModel.js +32 -0
- package/dist/models/LikeModel.d.ts +10 -0
- package/dist/models/LikeModel.d.ts.map +1 -0
- package/dist/models/LikeModel.js +48 -0
- package/dist/models/NotificationModel.d.ts +14 -0
- package/dist/models/NotificationModel.d.ts.map +1 -0
- package/dist/models/NotificationModel.js +66 -0
- package/dist/models/PaymentGatewayCustomerModel.d.ts +6 -0
- package/dist/models/PaymentGatewayCustomerModel.d.ts.map +1 -0
- package/dist/models/PaymentGatewayCustomerModel.js +31 -0
- package/dist/models/PlanFeatureModel.d.ts +11 -0
- package/dist/models/PlanFeatureModel.d.ts.map +1 -0
- package/dist/models/PlanFeatureModel.js +50 -0
- package/dist/models/PlanModel.d.ts +15 -0
- package/dist/models/PlanModel.d.ts.map +1 -0
- package/dist/models/PlanModel.js +68 -0
- package/dist/models/PostImageModel.d.ts +10 -0
- package/dist/models/PostImageModel.d.ts.map +1 -0
- package/dist/models/PostImageModel.js +45 -0
- package/dist/models/PostModel.d.ts +20 -0
- package/dist/models/PostModel.d.ts.map +1 -0
- package/dist/models/PostModel.js +87 -0
- package/dist/models/ProductImageModel.d.ts +10 -0
- package/dist/models/ProductImageModel.d.ts.map +1 -0
- package/dist/models/ProductImageModel.js +45 -0
- package/dist/models/ProductModel.d.ts +20 -0
- package/dist/models/ProductModel.d.ts.map +1 -0
- package/dist/models/ProductModel.js +96 -0
- package/dist/models/ReviewModel.d.ts +7 -0
- package/dist/models/ReviewModel.d.ts.map +1 -0
- package/dist/models/ReviewModel.js +36 -0
- package/dist/models/ServiceProviderModel.d.ts +23 -0
- package/dist/models/ServiceProviderModel.d.ts.map +1 -0
- package/dist/models/ServiceProviderModel.js +109 -0
- package/dist/models/SessionModel.d.ts +8 -0
- package/dist/models/SessionModel.d.ts.map +1 -0
- package/dist/models/SessionModel.js +40 -0
- package/dist/models/SpeechModel.d.ts +7 -0
- package/dist/models/SpeechModel.d.ts.map +1 -0
- package/dist/models/SpeechModel.js +32 -0
- package/dist/models/SubscriptionHistoryModel.d.ts +12 -0
- package/dist/models/SubscriptionHistoryModel.d.ts.map +1 -0
- package/dist/models/SubscriptionHistoryModel.js +60 -0
- package/dist/models/SubscriptionModel.d.ts +11 -0
- package/dist/models/SubscriptionModel.d.ts.map +1 -0
- package/dist/models/SubscriptionModel.js +53 -0
- package/dist/models/TopicModel.d.ts +7 -0
- package/dist/models/TopicModel.d.ts.map +1 -0
- package/dist/models/TopicModel.js +31 -0
- package/dist/models/TransactionModel.d.ts +15 -0
- package/dist/models/TransactionModel.d.ts.map +1 -0
- package/dist/models/TransactionModel.js +76 -0
- package/dist/models/UploadModel.d.ts +24 -0
- package/dist/models/UploadModel.d.ts.map +1 -0
- package/dist/models/UploadModel.js +119 -0
- package/dist/models/UserModel.d.ts +47 -0
- package/dist/models/UserModel.d.ts.map +1 -0
- package/dist/models/UserModel.js +237 -0
- package/dist/models/UserProfileModel.d.ts +28 -0
- package/dist/models/UserProfileModel.d.ts.map +1 -0
- package/dist/models/UserProfileModel.js +138 -0
- package/dist/models/index.d.ts +49 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +64 -0
- package/dist/services/StripeService.js +288 -0
- package/dist/services/mobile/ArticleCommentService.js +479 -0
- package/dist/services/mobile/ArticleService.js +507 -0
- package/dist/services/mobile/AuthService.js +362 -0
- package/dist/services/mobile/BusinessService.js +267 -0
- package/dist/services/mobile/BusinessServiceService.js +383 -0
- package/dist/services/mobile/CardService.js +249 -0
- package/dist/services/mobile/ChatService.js +324 -0
- package/dist/services/mobile/CommunityMemberService.js +193 -0
- package/dist/services/mobile/CommunityService.js +561 -0
- package/dist/services/mobile/CompleteProfileService.js +308 -0
- package/dist/services/mobile/ConnectionService.js +338 -0
- package/dist/services/mobile/EventAttendanceService.js +343 -0
- package/dist/services/mobile/EventService.js +540 -0
- package/dist/services/mobile/NotificationService.js +89 -0
- package/dist/services/mobile/PasswordResetService.js +168 -0
- package/dist/services/mobile/PlanService.js +85 -0
- package/dist/services/mobile/PostCommentService.js +611 -0
- package/dist/services/mobile/PostService.js +640 -0
- package/dist/services/mobile/ProductService.js +360 -0
- package/dist/services/mobile/RedisService.js +16 -0
- package/dist/services/mobile/TransactionService.js +51 -0
- package/dist/services/mobile/UploadService.js +110 -0
- package/dist/services/mobile/UserService.js +128 -0
- package/package.json +73 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const typedi_1 = require("typedi");
|
|
13
|
+
const AppError_1 = require("../../common/errors/AppError");
|
|
14
|
+
const UserRepository_1 = require("../../repositories/UserRepository");
|
|
15
|
+
const DiagnosisLevelRepository_1 = require("@/repositories/DiagnosisLevelRepository");
|
|
16
|
+
const InterestRepository_1 = require("@/repositories/InterestRepository");
|
|
17
|
+
const UserEnums_1 = require("@/common/enums/UserEnums");
|
|
18
|
+
const SpeechRepository_1 = require("@/repositories/SpeechRepository");
|
|
19
|
+
const EducationRepository_1 = require("@/repositories/EducationRepository");
|
|
20
|
+
const ChallengeRepository_1 = require("@/repositories/ChallengeRepository");
|
|
21
|
+
const typeorm_1 = require("typeorm");
|
|
22
|
+
const GoalRepository_1 = require("@/repositories/GoalRepository");
|
|
23
|
+
let CompleteProfileService = class CompleteProfileService {
|
|
24
|
+
userRepository;
|
|
25
|
+
diagnosisLevelRepository;
|
|
26
|
+
interestRepository;
|
|
27
|
+
userProfileRepository;
|
|
28
|
+
speechRepository;
|
|
29
|
+
educationRepository;
|
|
30
|
+
challengeRepository;
|
|
31
|
+
goalRepository;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.userRepository = new UserRepository_1.UserRepository();
|
|
34
|
+
this.diagnosisLevelRepository = new DiagnosisLevelRepository_1.DiagnosisLevelRepository();
|
|
35
|
+
this.interestRepository = new InterestRepository_1.InterestRepository();
|
|
36
|
+
this.userProfileRepository = new UserRepository_1.UserProfileRepository();
|
|
37
|
+
this.speechRepository = new SpeechRepository_1.SpeechRepository();
|
|
38
|
+
this.educationRepository = new EducationRepository_1.EducationRepository();
|
|
39
|
+
this.challengeRepository = new ChallengeRepository_1.ChallengeRepository();
|
|
40
|
+
this.goalRepository = new GoalRepository_1.GoalRepository();
|
|
41
|
+
}
|
|
42
|
+
async submitStepOneForm(createStepOneFormDto, user_id) {
|
|
43
|
+
let message;
|
|
44
|
+
const { interest, diagnosis_level, date_of_birth, user_relationship } = createStepOneFormDto;
|
|
45
|
+
const foundDiagnosis_level = await this.diagnosisLevelRepository.basicFindOneByConditions({ uuid: diagnosis_level });
|
|
46
|
+
if (!foundDiagnosis_level)
|
|
47
|
+
throw new AppError_1.AppError('Selected diagnosis level is invalid', 404);
|
|
48
|
+
const foundInterest = await this.interestRepository.basicFindOneByConditions({ uuid: interest });
|
|
49
|
+
if (!foundInterest)
|
|
50
|
+
throw new AppError_1.AppError('Selected interest is invalid', 404);
|
|
51
|
+
let existingProfile = await this.userProfileRepository.getRepo().findOne({ where: { user: { id: user_id } } });
|
|
52
|
+
if (existingProfile) {
|
|
53
|
+
await this.userProfileRepository.updateOne({
|
|
54
|
+
user_id,
|
|
55
|
+
}, {
|
|
56
|
+
diagnosis_level_id: foundDiagnosis_level.id,
|
|
57
|
+
interest_id: foundInterest.id,
|
|
58
|
+
account_type: user_relationship,
|
|
59
|
+
date_of_birth: date_of_birth,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
await this.userProfileRepository.create({
|
|
64
|
+
diagnosis_level_id: foundDiagnosis_level.id,
|
|
65
|
+
interest_id: foundInterest.id,
|
|
66
|
+
user_id,
|
|
67
|
+
account_type: user_relationship,
|
|
68
|
+
date_of_birth: date_of_birth,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
await this.userRepository.updateOne({
|
|
72
|
+
id: user_id
|
|
73
|
+
}, {
|
|
74
|
+
profile_level: UserEnums_1.ProfileLevel.STEP_ONE
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
successful: true,
|
|
78
|
+
data: null,
|
|
79
|
+
message: "Step 1 form submitted successfully"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async getStepOneFormOptions() {
|
|
83
|
+
const foundDiagnosis_level = await this.diagnosisLevelRepository.getRepo().find({
|
|
84
|
+
select: ['name', 'uuid']
|
|
85
|
+
});
|
|
86
|
+
const foundInterest = await this.interestRepository.getRepo().find({
|
|
87
|
+
select: ['name', 'uuid']
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
successful: true,
|
|
91
|
+
data: {
|
|
92
|
+
interests: foundInterest,
|
|
93
|
+
diagnosis_levels: foundDiagnosis_level,
|
|
94
|
+
user_relationship: UserEnums_1.AccountType
|
|
95
|
+
},
|
|
96
|
+
message: "Step 1 form data fetched successfully!"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async submitStepTwoForm(createSteptwoFormDto, user_id) {
|
|
100
|
+
let message;
|
|
101
|
+
const { gender, speech } = createSteptwoFormDto;
|
|
102
|
+
const foundSpeech = await this.speechRepository.basicFindOneByConditions({ uuid: speech });
|
|
103
|
+
if (!foundSpeech)
|
|
104
|
+
throw new AppError_1.AppError('Selected speech is invalid', 404);
|
|
105
|
+
let existingProfile = await this.userProfileRepository.getRepo().findOne({ where: { user: { id: user_id } } });
|
|
106
|
+
if (existingProfile) {
|
|
107
|
+
await this.userProfileRepository.updateOne({
|
|
108
|
+
user_id,
|
|
109
|
+
}, {
|
|
110
|
+
gender,
|
|
111
|
+
speech_id: foundSpeech.id,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
await this.userProfileRepository.create({
|
|
116
|
+
gender,
|
|
117
|
+
speech_id: foundSpeech.id,
|
|
118
|
+
user_id,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
await this.userRepository.updateOne({
|
|
122
|
+
id: user_id
|
|
123
|
+
}, {
|
|
124
|
+
profile_level: UserEnums_1.ProfileLevel.STEP_TWO
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
successful: true,
|
|
128
|
+
data: null,
|
|
129
|
+
message: "Step 2 form submitted successfully"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async getStepTwoFormOptions() {
|
|
133
|
+
const speeches = await this.speechRepository.getRepo().find({
|
|
134
|
+
select: ['name', 'uuid']
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
successful: true,
|
|
138
|
+
data: {
|
|
139
|
+
gender: UserEnums_1.GENDER,
|
|
140
|
+
speeches
|
|
141
|
+
},
|
|
142
|
+
message: "Step 2 form data fetched successfully!"
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async submitStepThreeForm(createStepthreeFormDto, user_id) {
|
|
146
|
+
let message;
|
|
147
|
+
const { education, challenges_selections, other_challenges } = createStepthreeFormDto;
|
|
148
|
+
const foundEducation = await this.educationRepository.basicFindOneByConditions({ uuid: education });
|
|
149
|
+
if (!foundEducation)
|
|
150
|
+
throw new AppError_1.AppError('Selected education is invalid', 404);
|
|
151
|
+
let challengesId = [];
|
|
152
|
+
challenges_selections.map(async (challenge) => {
|
|
153
|
+
const existingChallenge = await this.challengeRepository.basicFindOneByConditions({ name: challenge });
|
|
154
|
+
if (!existingChallenge) {
|
|
155
|
+
const foundChallenge = await this.challengeRepository.basicFindOneByConditions({ uuid: challenge });
|
|
156
|
+
if (!foundChallenge)
|
|
157
|
+
throw new AppError_1.AppError('Selected challenge is invalid', 404);
|
|
158
|
+
challengesId.push(foundChallenge.id);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
if (other_challenges && other_challenges.length > 0) {
|
|
162
|
+
other_challenges.map(async (challenge) => {
|
|
163
|
+
const foundChallenge = await this.challengeRepository.create({
|
|
164
|
+
name: challenge,
|
|
165
|
+
user_id
|
|
166
|
+
});
|
|
167
|
+
challengesId.push(foundChallenge.id);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
let existingProfile = await this.userProfileRepository.getRepo().findOne({ where: { user: { id: user_id } } });
|
|
171
|
+
if (existingProfile) {
|
|
172
|
+
await this.userProfileRepository.updateOne({
|
|
173
|
+
user_id,
|
|
174
|
+
}, {
|
|
175
|
+
child_education_id: foundEducation.id,
|
|
176
|
+
challenges: challengesId,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
await this.userProfileRepository.create({
|
|
181
|
+
child_education_id: foundEducation.id,
|
|
182
|
+
challenges: challengesId,
|
|
183
|
+
user_id,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
await this.userRepository.updateOne({
|
|
187
|
+
id: user_id
|
|
188
|
+
}, {
|
|
189
|
+
profile_level: UserEnums_1.ProfileLevel.STEP_THREE
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
successful: true,
|
|
193
|
+
data: null,
|
|
194
|
+
message: "Step 3 form submitted successfully"
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
async getStepThreeFormOptions() {
|
|
198
|
+
const challenges = await this.challengeRepository.getRepo().find({
|
|
199
|
+
select: ['name', 'uuid'],
|
|
200
|
+
where: {
|
|
201
|
+
user_id: (0, typeorm_1.IsNull)()
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
const education = await this.educationRepository.getRepo().find({
|
|
205
|
+
select: ['name', 'uuid'],
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
successful: true,
|
|
209
|
+
data: {
|
|
210
|
+
education,
|
|
211
|
+
challenges
|
|
212
|
+
},
|
|
213
|
+
message: "Step 3 form data fetched successfully!"
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
async submitStepFiveForm(createStepFiveFormDto, user_id) {
|
|
217
|
+
let message;
|
|
218
|
+
const { city, state, country, coordinates } = createStepFiveFormDto;
|
|
219
|
+
let existingProfile = await this.userProfileRepository.getRepo().findOne({ where: { user: { id: user_id } } });
|
|
220
|
+
if (existingProfile) {
|
|
221
|
+
await this.userProfileRepository.updateWithCoordinates({
|
|
222
|
+
user_id,
|
|
223
|
+
}, {
|
|
224
|
+
location: {
|
|
225
|
+
city,
|
|
226
|
+
state,
|
|
227
|
+
country,
|
|
228
|
+
coordinates
|
|
229
|
+
}
|
|
230
|
+
}, coordinates.long, coordinates.lat);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
await this.userProfileRepository.createWithCoordinates({
|
|
234
|
+
location: {
|
|
235
|
+
city,
|
|
236
|
+
state,
|
|
237
|
+
country,
|
|
238
|
+
coordinates
|
|
239
|
+
}
|
|
240
|
+
}, coordinates.long, coordinates.lat);
|
|
241
|
+
}
|
|
242
|
+
await this.userRepository.updateOne({
|
|
243
|
+
id: user_id
|
|
244
|
+
}, {
|
|
245
|
+
profile_level: UserEnums_1.ProfileLevel.COMPLETED
|
|
246
|
+
});
|
|
247
|
+
return {
|
|
248
|
+
successful: true,
|
|
249
|
+
data: null,
|
|
250
|
+
message: "Step 4 form submitted successfully"
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
async submitStepFourForm(createStepFourFormDto, user_id) {
|
|
254
|
+
let message;
|
|
255
|
+
const { goals } = createStepFourFormDto;
|
|
256
|
+
let goalsId = [];
|
|
257
|
+
goals.map(async (goal) => {
|
|
258
|
+
const existingGoal = await this.goalRepository.basicFindOneByConditions({ name: goal });
|
|
259
|
+
if (!existingGoal) {
|
|
260
|
+
const foundGoal = await this.goalRepository.basicFindOneByConditions({ uuid: goal });
|
|
261
|
+
if (!foundGoal)
|
|
262
|
+
throw new AppError_1.AppError('Selected goal is invalid', 404);
|
|
263
|
+
goalsId.push(foundGoal.id);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
let existingProfile = await this.userProfileRepository.getRepo().findOne({ where: { user: { id: user_id } } });
|
|
267
|
+
if (existingProfile) {
|
|
268
|
+
await this.userProfileRepository.updateOne({
|
|
269
|
+
user_id,
|
|
270
|
+
}, {
|
|
271
|
+
goals: goalsId,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
await this.userProfileRepository.create({
|
|
276
|
+
goals: goalsId,
|
|
277
|
+
user_id,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
await this.userRepository.updateOne({
|
|
281
|
+
id: user_id
|
|
282
|
+
}, {
|
|
283
|
+
profile_level: UserEnums_1.ProfileLevel.STEP_FOUR
|
|
284
|
+
});
|
|
285
|
+
return {
|
|
286
|
+
successful: true,
|
|
287
|
+
data: null,
|
|
288
|
+
message: "Step 5 form submitted successfully"
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
async getStepFourFormOptions() {
|
|
292
|
+
const goals = await this.goalRepository.getRepo().find({
|
|
293
|
+
select: ['name', 'uuid'],
|
|
294
|
+
});
|
|
295
|
+
return {
|
|
296
|
+
successful: true,
|
|
297
|
+
data: {
|
|
298
|
+
goals
|
|
299
|
+
},
|
|
300
|
+
message: "Step 5 form data fetched successfully!"
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
CompleteProfileService = __decorate([
|
|
305
|
+
(0, typedi_1.Service)(),
|
|
306
|
+
__metadata("design:paramtypes", [])
|
|
307
|
+
], CompleteProfileService);
|
|
308
|
+
exports.default = CompleteProfileService;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const typedi_1 = require("typedi");
|
|
13
|
+
const logger_1 = require("../../common/configs/logger");
|
|
14
|
+
const AppError_1 = require("../../common/errors/AppError");
|
|
15
|
+
const messages_1 = require("../../common/constants/messages");
|
|
16
|
+
const ConnectionRepository_1 = require("@/repositories/ConnectionRepository");
|
|
17
|
+
const Paginator_1 = require("@/transformers/Paginator");
|
|
18
|
+
const ConnectionEnum_1 = require("@/common/enums/ConnectionEnum");
|
|
19
|
+
const UserRepository_1 = require("@/repositories/UserRepository");
|
|
20
|
+
const configs_1 = require("@/common/configs");
|
|
21
|
+
const NotificationRepository_1 = require("@/repositories/NotificationRepository");
|
|
22
|
+
const NotificationEnum_1 = require("@/common/enums/NotificationEnum");
|
|
23
|
+
const IndexEnum_1 = require("@/common/enums/IndexEnum");
|
|
24
|
+
const typeorm_1 = require("typeorm");
|
|
25
|
+
const UserResource_1 = require("@/transformers/resources/UserResource");
|
|
26
|
+
let ConnectionService = class ConnectionService {
|
|
27
|
+
connectionRepository;
|
|
28
|
+
userRepository;
|
|
29
|
+
notificationRepository;
|
|
30
|
+
constructor() {
|
|
31
|
+
this.notificationRepository = new NotificationRepository_1.NotificationRepository();
|
|
32
|
+
this.userRepository = new UserRepository_1.UserRepository();
|
|
33
|
+
this.connectionRepository = new ConnectionRepository_1.ConnectionRepository();
|
|
34
|
+
}
|
|
35
|
+
async sendConnectionRequest(receiver_id, user_id) {
|
|
36
|
+
let message;
|
|
37
|
+
const connectionReceiver = await this.userRepository.findOneAndRelations({
|
|
38
|
+
where: {
|
|
39
|
+
uuid: receiver_id,
|
|
40
|
+
id: (0, typeorm_1.Not)(user_id)
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (!connectionReceiver) {
|
|
44
|
+
message = messages_1.dynamic_messages.NOT_FOUND("User account");
|
|
45
|
+
logger_1.logger.info(message);
|
|
46
|
+
throw new AppError_1.AppError(message, 404);
|
|
47
|
+
}
|
|
48
|
+
const connectionSender = await this.userRepository.basicFindOneByConditions({
|
|
49
|
+
id: user_id
|
|
50
|
+
});
|
|
51
|
+
if (!connectionSender) {
|
|
52
|
+
message = messages_1.dynamic_messages.NOT_FOUND("User account");
|
|
53
|
+
logger_1.logger.info(message);
|
|
54
|
+
throw new AppError_1.AppError(message, 404);
|
|
55
|
+
}
|
|
56
|
+
const connection = await this.connectionRepository.findOneAndRelations({
|
|
57
|
+
where: [
|
|
58
|
+
{
|
|
59
|
+
sender_id: connectionReceiver.id
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
receiver_id: connectionReceiver.id
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
relations: ['receiver', 'sender']
|
|
66
|
+
});
|
|
67
|
+
if (connection && connection?.status === ConnectionEnum_1.ConnectionStatus.ACCEPTED) {
|
|
68
|
+
message = `${connectionReceiver?.full_name} is already a connection`;
|
|
69
|
+
logger_1.logger.info(message);
|
|
70
|
+
throw new AppError_1.AppError(message, 400);
|
|
71
|
+
}
|
|
72
|
+
if (connection && connection?.status === ConnectionEnum_1.ConnectionStatus.PENDING) {
|
|
73
|
+
message = `Your connection request is still pending`;
|
|
74
|
+
logger_1.logger.info(message);
|
|
75
|
+
throw new AppError_1.AppError(message, 400);
|
|
76
|
+
}
|
|
77
|
+
const newConnection = await this.connectionRepository.create({
|
|
78
|
+
sender_id: user_id,
|
|
79
|
+
receiver_id: connectionReceiver.id
|
|
80
|
+
});
|
|
81
|
+
await this.notificationRepository.save({
|
|
82
|
+
user_id: connectionReceiver.id,
|
|
83
|
+
type: NotificationEnum_1.NotificationType.NEW_CONNECTION_REQUEST,
|
|
84
|
+
message: `You have a new connection request from ${connectionSender.full_name}`,
|
|
85
|
+
notifiable_id: newConnection.id,
|
|
86
|
+
notifiable_type: IndexEnum_1.SYS_MODELS.CONNECTION_MODEL
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
successful: true,
|
|
90
|
+
data: null,
|
|
91
|
+
message: `Your connection request was successfully sent!`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
async rejectConnectionRequest(connection_id, user_id, rejection_type) {
|
|
95
|
+
switch (rejection_type) {
|
|
96
|
+
case ConnectionEnum_1.ConnectionRejectionType.REJECT_CONNECTION:
|
|
97
|
+
return await this.rejectReceivedConnectionRequest(user_id, connection_id);
|
|
98
|
+
case ConnectionEnum_1.ConnectionRejectionType.WITHDRAW_CONNECTION:
|
|
99
|
+
return await this.withdrawConnectionRequest(user_id, connection_id);
|
|
100
|
+
case ConnectionEnum_1.ConnectionRejectionType.REJECT_CONNECTION:
|
|
101
|
+
return await this.cancelConnection(user_id, connection_id);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async rejectReceivedConnectionRequest(user_id, connection_id) {
|
|
105
|
+
let message;
|
|
106
|
+
const connection = await this.connectionRepository.findOneAndRelations({
|
|
107
|
+
where: {
|
|
108
|
+
receiver_id: user_id,
|
|
109
|
+
uuid: connection_id
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
if (!connection) {
|
|
113
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Connection");
|
|
114
|
+
logger_1.logger.info(message);
|
|
115
|
+
throw new AppError_1.AppError(message, 404);
|
|
116
|
+
}
|
|
117
|
+
if (connection && connection?.status === ConnectionEnum_1.ConnectionStatus.ACCEPTED) {
|
|
118
|
+
message = `${connection?.sender?.full_name}' connection request has already been accepted`;
|
|
119
|
+
logger_1.logger.info(message);
|
|
120
|
+
throw new AppError_1.AppError(message, 400);
|
|
121
|
+
}
|
|
122
|
+
await this.connectionRepository.deleteByCondition({
|
|
123
|
+
receiver_id: user_id,
|
|
124
|
+
uuid: connection_id
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
successful: true,
|
|
128
|
+
data: null,
|
|
129
|
+
message: `Connection request was declined successfully`
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async withdrawConnectionRequest(user_id, connection_id) {
|
|
133
|
+
let message;
|
|
134
|
+
const connection = await this.connectionRepository.findOneAndRelations({
|
|
135
|
+
where: {
|
|
136
|
+
sender_id: user_id,
|
|
137
|
+
uuid: connection_id
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (!connection) {
|
|
141
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Connection");
|
|
142
|
+
logger_1.logger.info(message);
|
|
143
|
+
throw new AppError_1.AppError(message, 404);
|
|
144
|
+
}
|
|
145
|
+
if (connection && connection?.status === ConnectionEnum_1.ConnectionStatus.ACCEPTED) {
|
|
146
|
+
message = `${connection?.sender?.full_name}' connection request has already been accepted`;
|
|
147
|
+
logger_1.logger.info(message);
|
|
148
|
+
throw new AppError_1.AppError(message, 400);
|
|
149
|
+
}
|
|
150
|
+
await this.connectionRepository.deleteByCondition({
|
|
151
|
+
sender_id: user_id,
|
|
152
|
+
uuid: connection_id
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
successful: true,
|
|
156
|
+
data: null,
|
|
157
|
+
message: `Connection request was declined successfully`
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
async cancelConnection(user_id, connection_id) {
|
|
161
|
+
let message;
|
|
162
|
+
const connection = await this.connectionRepository.findOneAndRelations({
|
|
163
|
+
where: [
|
|
164
|
+
{
|
|
165
|
+
sender_id: user_id,
|
|
166
|
+
uuid: connection_id,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
receiver_id: user_id,
|
|
170
|
+
uuid: connection_id
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
if (!connection) {
|
|
175
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Connection");
|
|
176
|
+
logger_1.logger.info(message);
|
|
177
|
+
throw new AppError_1.AppError(message, 404);
|
|
178
|
+
}
|
|
179
|
+
if (connection && connection?.status !== ConnectionEnum_1.ConnectionStatus.ACCEPTED) {
|
|
180
|
+
message = `You can only cancel an accepted connection!`;
|
|
181
|
+
logger_1.logger.info(message);
|
|
182
|
+
throw new AppError_1.AppError(message, 400);
|
|
183
|
+
}
|
|
184
|
+
await this.connectionRepository.deleteByCondition({
|
|
185
|
+
uuid: connection_id
|
|
186
|
+
});
|
|
187
|
+
return {
|
|
188
|
+
successful: true,
|
|
189
|
+
data: null,
|
|
190
|
+
message: `Connection was cancelled successfully`
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async acceptConnection(connection_id, user_id) {
|
|
194
|
+
let message;
|
|
195
|
+
const user = await this.userRepository.basicFindOneByConditions({
|
|
196
|
+
id: user_id
|
|
197
|
+
});
|
|
198
|
+
const connection = await this.connectionRepository.findOneAndRelations({
|
|
199
|
+
where: {
|
|
200
|
+
receiver_id: user_id,
|
|
201
|
+
uuid: connection_id
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
if (!connection) {
|
|
205
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Connection");
|
|
206
|
+
logger_1.logger.info(message);
|
|
207
|
+
throw new AppError_1.AppError(message, 404);
|
|
208
|
+
}
|
|
209
|
+
if (!user) {
|
|
210
|
+
message = messages_1.dynamic_messages.NOT_FOUND("User account");
|
|
211
|
+
logger_1.logger.info(message);
|
|
212
|
+
throw new AppError_1.AppError(message, 404);
|
|
213
|
+
}
|
|
214
|
+
if (connection && connection?.status !== ConnectionEnum_1.ConnectionStatus.ACCEPTED) {
|
|
215
|
+
message = `You have already accepted this connection!`;
|
|
216
|
+
logger_1.logger.info(message);
|
|
217
|
+
throw new AppError_1.AppError(message, 400);
|
|
218
|
+
}
|
|
219
|
+
await this.connectionRepository.updateOne({
|
|
220
|
+
uuid: connection_id,
|
|
221
|
+
receiver_id: user_id
|
|
222
|
+
}, {
|
|
223
|
+
status: ConnectionEnum_1.ConnectionStatus.ACCEPTED
|
|
224
|
+
});
|
|
225
|
+
await this.notificationRepository.save({
|
|
226
|
+
user_id: connection?.sender_id,
|
|
227
|
+
type: NotificationEnum_1.NotificationType.NEW_CONNECTION_REQUEST,
|
|
228
|
+
message: `${user.full_name} accepted your have a new connection request`,
|
|
229
|
+
notifiable_id: connection.id,
|
|
230
|
+
notifiable_type: IndexEnum_1.SYS_MODELS.CONNECTION_MODEL
|
|
231
|
+
});
|
|
232
|
+
return {
|
|
233
|
+
successful: true,
|
|
234
|
+
data: null,
|
|
235
|
+
message: `Connection was accepted] successfully`
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async fetchAcceptedConnection(user_id, pageNumber) {
|
|
239
|
+
const page_number = pageNumber || 1;
|
|
240
|
+
const limit = configs_1.CONFIGS.DATA_FETCH_LIMIT || 10;
|
|
241
|
+
const options = {
|
|
242
|
+
metadata: {
|
|
243
|
+
user_id
|
|
244
|
+
},
|
|
245
|
+
page_number,
|
|
246
|
+
limit
|
|
247
|
+
};
|
|
248
|
+
const { rows, total } = await this.connectionRepository.getAcceptedConnections(options);
|
|
249
|
+
const connections = rows.map((connection, index) => ({
|
|
250
|
+
uuid: connection.uuid,
|
|
251
|
+
created_at: connection.created_at,
|
|
252
|
+
status: connection.status,
|
|
253
|
+
sender: {
|
|
254
|
+
...UserResource_1.UserResource.userToJSON(connection.sender)
|
|
255
|
+
},
|
|
256
|
+
receiver: {
|
|
257
|
+
...UserResource_1.UserResource.userToJSON(connection.receiver)
|
|
258
|
+
}
|
|
259
|
+
}));
|
|
260
|
+
const data = (0, Paginator_1.paginator)({
|
|
261
|
+
total,
|
|
262
|
+
perPage: limit,
|
|
263
|
+
currentPage: page_number,
|
|
264
|
+
data: connections,
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
successful: true,
|
|
268
|
+
data,
|
|
269
|
+
message: `Connections fetched successfully`
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
async getReceivedPendingConnectionRequests(user_id, pageNumber) {
|
|
273
|
+
const page_number = pageNumber || 1;
|
|
274
|
+
const limit = configs_1.CONFIGS.DATA_FETCH_LIMIT || 10;
|
|
275
|
+
const options = {
|
|
276
|
+
metadata: {
|
|
277
|
+
user_id
|
|
278
|
+
},
|
|
279
|
+
page_number,
|
|
280
|
+
limit
|
|
281
|
+
};
|
|
282
|
+
const { rows, total } = await this.connectionRepository.getReceivedPendingConnectionRequests(options);
|
|
283
|
+
const connections = rows.map((connection, index) => ({
|
|
284
|
+
uuid: connection.uuid,
|
|
285
|
+
created_at: connection.created_at,
|
|
286
|
+
status: connection.status,
|
|
287
|
+
sender: {
|
|
288
|
+
...UserResource_1.UserResource.userToJSON(connection.sender)
|
|
289
|
+
}
|
|
290
|
+
}));
|
|
291
|
+
const data = (0, Paginator_1.paginator)({
|
|
292
|
+
total,
|
|
293
|
+
perPage: limit,
|
|
294
|
+
currentPage: page_number,
|
|
295
|
+
data: connections,
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
successful: true,
|
|
299
|
+
data,
|
|
300
|
+
message: `Connections requests fetched successfully`
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
async getRecommendedConnctions(user_id, pageNumber) {
|
|
304
|
+
let message;
|
|
305
|
+
const page_number = pageNumber || 1;
|
|
306
|
+
const limit = configs_1.CONFIGS.DATA_FETCH_LIMIT || 10;
|
|
307
|
+
const dataFetchParams = {
|
|
308
|
+
page_number,
|
|
309
|
+
limit,
|
|
310
|
+
metadata: {
|
|
311
|
+
user_id
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const { data, total, perPage, page } = await this.connectionRepository.getRecommendedConnctions(dataFetchParams);
|
|
315
|
+
const { raw, entities } = data;
|
|
316
|
+
const users = entities.map((user, index) => ({
|
|
317
|
+
...UserResource_1.UserResource.userToJSON(user),
|
|
318
|
+
connection_state: raw[index].connection_state,
|
|
319
|
+
}));
|
|
320
|
+
const connections = (0, Paginator_1.paginator)({
|
|
321
|
+
total,
|
|
322
|
+
perPage,
|
|
323
|
+
currentPage: page,
|
|
324
|
+
data: users,
|
|
325
|
+
});
|
|
326
|
+
message = messages_1.dynamic_messages.FETCHED_SUCCESSFULLY("User");
|
|
327
|
+
return {
|
|
328
|
+
successful: true,
|
|
329
|
+
data: connections,
|
|
330
|
+
message
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
ConnectionService = __decorate([
|
|
335
|
+
(0, typedi_1.Service)(),
|
|
336
|
+
__metadata("design:paramtypes", [])
|
|
337
|
+
], ConnectionService);
|
|
338
|
+
exports.default = ConnectionService;
|