@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,168 @@
|
|
|
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 UserRepository_1 = require("../../repositories/UserRepository");
|
|
14
|
+
const AppError_1 = require("../../common/errors/AppError");
|
|
15
|
+
const UserEnums_1 = require("../../common/enums/UserEnums");
|
|
16
|
+
const utils_1 = require("../../common/utils");
|
|
17
|
+
const EmailProducer_1 = require("../../queues/producers/EmailProducer");
|
|
18
|
+
const configs_1 = require("../../common/configs");
|
|
19
|
+
const messages_1 = require("../../common/constants/messages");
|
|
20
|
+
const logger_1 = require("@/common/configs/logger");
|
|
21
|
+
let PasswordResetService = class PasswordResetService {
|
|
22
|
+
userRepository;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.userRepository = new UserRepository_1.UserRepository();
|
|
25
|
+
}
|
|
26
|
+
async requestPasswordReset(req) {
|
|
27
|
+
const { email } = req;
|
|
28
|
+
let message;
|
|
29
|
+
let whereConditions = {
|
|
30
|
+
email,
|
|
31
|
+
};
|
|
32
|
+
const existingUser = await this.userRepository.basicFindOneByConditions(whereConditions);
|
|
33
|
+
if (!existingUser) {
|
|
34
|
+
throw new AppError_1.AppError(messages_1.USER_MESSAGES.ACCOUNT.NOT_FOUND, 404);
|
|
35
|
+
}
|
|
36
|
+
if (existingUser.user_status !== UserEnums_1.AccountStatus.ACTIVE) {
|
|
37
|
+
message = "You cannot change the password of an inactive account";
|
|
38
|
+
throw new AppError_1.AppError(message, 403);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const passwordResetToken = (0, utils_1.generateUUID)();
|
|
42
|
+
const { expiresAt, uuid } = passwordResetToken;
|
|
43
|
+
const { otp, expireAt: verification_expires_at } = (0, utils_1.generateOTP)(30);
|
|
44
|
+
await this.userRepository.updateOne({ uuid: existingUser.uuid, email }, {
|
|
45
|
+
reset_token: uuid,
|
|
46
|
+
reset_token_expires_at: expiresAt,
|
|
47
|
+
reset_otp: otp,
|
|
48
|
+
});
|
|
49
|
+
const { iv: ivHex, encryptedData } = (0, utils_1.encrypt)(email);
|
|
50
|
+
const reset_link = `${configs_1.CONFIGS.MAIN_WEBSITE_BASE_URL}/password/reset/${uuid}?hash=${ivHex}&ref=${encryptedData}`;
|
|
51
|
+
const messageBody = {
|
|
52
|
+
reset_link,
|
|
53
|
+
otp,
|
|
54
|
+
first_name: (0, utils_1.capitalizeFirst)(existingUser?.full_name),
|
|
55
|
+
email,
|
|
56
|
+
};
|
|
57
|
+
await (0, EmailProducer_1.sendPasswordResetRequestEmail)(messageBody);
|
|
58
|
+
return {
|
|
59
|
+
successful: true,
|
|
60
|
+
message: messages_1.dynamic_messages.PASSWWORD_RESET_SENT(email),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async setNewPasswordWithOtp(setNewPassword) {
|
|
65
|
+
const { confirm_password, otp, new_password } = setNewPassword;
|
|
66
|
+
let message;
|
|
67
|
+
if (confirm_password !== new_password) {
|
|
68
|
+
message = "Confirm password does not match the password";
|
|
69
|
+
logger_1.logger.error(message);
|
|
70
|
+
throw new AppError_1.AppError(message, 422);
|
|
71
|
+
}
|
|
72
|
+
const user = await this.userRepository.basicFindOneByConditions({
|
|
73
|
+
reset_otp: otp,
|
|
74
|
+
});
|
|
75
|
+
if (!user) {
|
|
76
|
+
message = "Invalid OTP";
|
|
77
|
+
logger_1.logger.error(message);
|
|
78
|
+
throw new AppError_1.AppError(message, 404);
|
|
79
|
+
}
|
|
80
|
+
if (user.user_status !== UserEnums_1.AccountStatus.ACTIVE) {
|
|
81
|
+
message = "You cannot change the password of an inactive account";
|
|
82
|
+
throw new AppError_1.AppError(message, 403);
|
|
83
|
+
}
|
|
84
|
+
// Check if OTP has expired
|
|
85
|
+
const expectedTokenExpirationDate = user.reset_token_expires_at;
|
|
86
|
+
const tokenHasExpired = (0, utils_1.hasExpired)(expectedTokenExpirationDate);
|
|
87
|
+
if (tokenHasExpired) {
|
|
88
|
+
message = "OTP has expired!";
|
|
89
|
+
throw new AppError_1.AppError(messages_1.USER_MESSAGES.EMAIL_VERIFICATION.EXPIRED, 403);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const password = await (0, utils_1.hashString)(new_password);
|
|
93
|
+
const { id, email, full_name } = user;
|
|
94
|
+
await this.userRepository.updateOne({
|
|
95
|
+
email: user.email,
|
|
96
|
+
id,
|
|
97
|
+
}, {
|
|
98
|
+
reset_otp: null,
|
|
99
|
+
password_hash: password,
|
|
100
|
+
reset_token_expires_at: null,
|
|
101
|
+
reset_token: null,
|
|
102
|
+
});
|
|
103
|
+
const messageBody = {
|
|
104
|
+
email,
|
|
105
|
+
first_name: (0, utils_1.capitalizeFirst)(full_name),
|
|
106
|
+
login_link: `${configs_1.CONFIGS.MAIN_WEBSITE_BASE_URL}/login`,
|
|
107
|
+
contact_link: `${configs_1.CONFIGS.MAIN_WEBSITE_BASE_URL}/contact-us`,
|
|
108
|
+
};
|
|
109
|
+
await (0, EmailProducer_1.sendPasswordResetConfirmationEmail)(messageBody);
|
|
110
|
+
return {
|
|
111
|
+
successful: true,
|
|
112
|
+
message: `Your account password was successfully changed`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async setNewPassword(req, hash, ref, reset_token) {
|
|
117
|
+
const { confirm_password, new_password } = req;
|
|
118
|
+
if (!hash || !ref || !reset_token) {
|
|
119
|
+
throw new AppError_1.AppError(messages_1.dynamic_messages.NOT_FOUND("Required params"), 404);
|
|
120
|
+
}
|
|
121
|
+
if (new_password !== confirm_password) {
|
|
122
|
+
throw new AppError_1.AppError("Password must match confirm password", 400);
|
|
123
|
+
}
|
|
124
|
+
const existingUser = await this.userRepository.basicFindOneByConditions({
|
|
125
|
+
reset_token,
|
|
126
|
+
});
|
|
127
|
+
if (!existingUser) {
|
|
128
|
+
throw new AppError_1.AppError(messages_1.USER_MESSAGES.ACCOUNT.NOT_FOUND, 404);
|
|
129
|
+
}
|
|
130
|
+
else if (existingUser.user_status == UserEnums_1.AccountStatus.PENDING) {
|
|
131
|
+
await this.userRepository.updateOne({ uuid: existingUser.uuid, email: existingUser.email }, { user_status: UserEnums_1.AccountStatus.ACTIVE, is_verified: true });
|
|
132
|
+
// throw new AppError(
|
|
133
|
+
// USER_MESSAGES.AUTH.PASSWWORD_RESET.INACTIVE_ACCOUNT
|
|
134
|
+
// );
|
|
135
|
+
}
|
|
136
|
+
const expectedTokenExpirationDate = existingUser.reset_token_expires_at;
|
|
137
|
+
const { id, email } = existingUser;
|
|
138
|
+
const tokenHasExpired = (0, utils_1.hasExpired)(expectedTokenExpirationDate);
|
|
139
|
+
if (tokenHasExpired) {
|
|
140
|
+
throw new AppError_1.AppError(messages_1.USER_MESSAGES.AUTH.PASSWWORD_RESET.EXPIRED, 400);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const password = await (0, utils_1.hashString)(new_password);
|
|
144
|
+
await this.userRepository.updateOne({ id, email }, {
|
|
145
|
+
password_hash: password,
|
|
146
|
+
reset_otp: null,
|
|
147
|
+
reset_token_expires_at: null,
|
|
148
|
+
reset_token: null,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const messageBody = {
|
|
152
|
+
email,
|
|
153
|
+
first_name: (0, utils_1.capitalizeFirst)(existingUser?.full_name),
|
|
154
|
+
login_link: `${configs_1.CONFIGS.MAIN_WEBSITE_BASE_URL}/login`,
|
|
155
|
+
contact_link: `${configs_1.CONFIGS.MAIN_WEBSITE_BASE_URL}/contact-us`,
|
|
156
|
+
};
|
|
157
|
+
await (0, EmailProducer_1.sendPasswordResetConfirmationEmail)(messageBody);
|
|
158
|
+
return {
|
|
159
|
+
successful: true,
|
|
160
|
+
message: `Your account password was successfully changed`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
PasswordResetService = __decorate([
|
|
165
|
+
(0, typedi_1.Service)(),
|
|
166
|
+
__metadata("design:paramtypes", [])
|
|
167
|
+
], PasswordResetService);
|
|
168
|
+
exports.default = PasswordResetService;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanService = void 0;
|
|
4
|
+
const logger_1 = require("@/common/configs/logger");
|
|
5
|
+
const messages_1 = require("@/common/constants/messages");
|
|
6
|
+
const AppError_1 = require("@/common/errors/AppError");
|
|
7
|
+
const CardRepository_1 = require("@/repositories/CardRepository");
|
|
8
|
+
const PlanRepository_1 = require("@/repositories/PlanRepository");
|
|
9
|
+
const UserRepository_1 = require("@/repositories/UserRepository");
|
|
10
|
+
const PlanCollection_1 = require("@/transformers/collections/PlanCollection");
|
|
11
|
+
const SubscriptionHistoryRepository_1 = require("@/repositories/SubscriptionHistoryRepository");
|
|
12
|
+
class PlanService {
|
|
13
|
+
planRepository;
|
|
14
|
+
userRepository;
|
|
15
|
+
cardRepository;
|
|
16
|
+
subscriptionHistoryRepository;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.planRepository = new PlanRepository_1.PlanRepository();
|
|
19
|
+
this.userRepository = new UserRepository_1.UserRepository();
|
|
20
|
+
this.cardRepository = new CardRepository_1.CardRepository();
|
|
21
|
+
this.subscriptionHistoryRepository = new SubscriptionHistoryRepository_1.SubscriptionHistoryRepository();
|
|
22
|
+
}
|
|
23
|
+
async fetchPlanFeatures(user_id) {
|
|
24
|
+
let message;
|
|
25
|
+
const foundUser = await this.userRepository.findOneAndRelations({
|
|
26
|
+
where: { id: user_id },
|
|
27
|
+
relations: ['plan']
|
|
28
|
+
});
|
|
29
|
+
if (!foundUser) {
|
|
30
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Your account");
|
|
31
|
+
logger_1.logger.error(message);
|
|
32
|
+
throw new AppError_1.AppError(message, 404);
|
|
33
|
+
}
|
|
34
|
+
const plans = await this.planRepository
|
|
35
|
+
.getRepo().createQueryBuilder("plan")
|
|
36
|
+
.leftJoinAndSelect("plan.planFeatures", "planFeature")
|
|
37
|
+
.leftJoinAndSelect("planFeature.feature", "feature")
|
|
38
|
+
.getMany();
|
|
39
|
+
return {
|
|
40
|
+
successful: true,
|
|
41
|
+
data: PlanCollection_1.PlanCollection.toJSON(plans, foundUser?.plan_id),
|
|
42
|
+
message: messages_1.dynamic_messages.FETCHED_SUCCESSFULLY("Plan features"),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async setNewPlan(user_id, plan_id) {
|
|
46
|
+
let message;
|
|
47
|
+
const foundPlan = await this.planRepository.basicFindOneByConditions({
|
|
48
|
+
uuid: plan_id
|
|
49
|
+
});
|
|
50
|
+
if (!foundPlan) {
|
|
51
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Your plan");
|
|
52
|
+
logger_1.logger.error(message);
|
|
53
|
+
throw new AppError_1.AppError(message, 404);
|
|
54
|
+
}
|
|
55
|
+
const foundUser = await this.userRepository.findOneAndRelations({
|
|
56
|
+
where: { id: user_id }
|
|
57
|
+
});
|
|
58
|
+
if (!foundUser) {
|
|
59
|
+
message = messages_1.dynamic_messages.NOT_FOUND("Your account");
|
|
60
|
+
logger_1.logger.error(message);
|
|
61
|
+
throw new AppError_1.AppError(message, 404);
|
|
62
|
+
}
|
|
63
|
+
const foundDefaultCard = await this.cardRepository.basicFindOneByConditions({
|
|
64
|
+
user_id: foundUser.id,
|
|
65
|
+
is_default: true
|
|
66
|
+
});
|
|
67
|
+
if (!foundDefaultCard) {
|
|
68
|
+
message = "You don't have any card set for default payment. Please set that to continue";
|
|
69
|
+
logger_1.logger.error(message);
|
|
70
|
+
throw new AppError_1.AppError(message, 404);
|
|
71
|
+
}
|
|
72
|
+
if (foundUser.plan_id == foundPlan.id) {
|
|
73
|
+
message = `You already have ${foundPlan.name} as your plan`;
|
|
74
|
+
logger_1.logger.error(message);
|
|
75
|
+
throw new AppError_1.AppError(message, 400);
|
|
76
|
+
}
|
|
77
|
+
await this.userRepository.updateOne({ uuid: foundUser.uuid }, { plan_id: foundPlan.id });
|
|
78
|
+
return {
|
|
79
|
+
successful: true,
|
|
80
|
+
data: null,
|
|
81
|
+
message: "Plan successfully changed",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.PlanService = PlanService;
|