diff --git a/app/api/services/web_contents.py b/app/api/services/web_contents.py index a0e128e..e7366ad 100644 --- a/app/api/services/web_contents.py +++ b/app/api/services/web_contents.py @@ -8,6 +8,7 @@ from sqlalchemy import func, desc from app.extensions import db from app.models import MembersProductsSettings, MembersProducts, ProductsColorStyle from threading import Thread +import requests class WebContentsService(BaseService): @@ -17,26 +18,26 @@ class WebContentsService(BaseService): web_contents_data = { "last_update": "0", "site_title": "my-site-title", - "site_description": "This is site description in the header", - "site_logo_text": "MY-GOOD-LOGO", + "site_description": "This is the site description in the header", + "site_logo_text": "MY-SITE-LOGO", "site_contact_email": "email@email.com", "site_contact_phone": "911 111 1111", - "site_keywords": "Responsive, HTML5, DSAThemes, Landing, Software, Mobile App, SaaS, Startup, Creative, Digital Product", + "site_keywords": "Health, Practioner, myPage, telemedicine, Software, Mobile App, Health Specialty, Startup, Creative, Digital Health", "facebook": "myface.facebook.com", "twitter": "mytwit.twitter.com", "youtube": "myyou.youtube.com", - "banner_text": "This is the main business text on the web page", - "banner_description": "Naira", + "banner_text": "Welcome to my online front desk", + "banner_description": "We focus on your better health outcomes ", "footer_description": "Any text under the logo on the footer", "about_description": "Naira", "banner_text": "Banner title for your new website. Adjust as needed.", "banner_description": "A brief overview of your banner title. Tailor the text to accurately reflect the interests and demographics of your audience.", "about_title": "This is about title section", - "about_description": "About Description - Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae", - "about_extra_1": "About Extra 1 - Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae", - "about_extra_2": "About - Extra 2 -Mauris donec ociis magnis sapien ipsum sagittis sapien tempor and volute gravida aliquet quaerat vitae ", + "about_description": "We are a team of dedicated general healthcare practitioners committed to providing compassionate, comprehensive care to patients and families in our community.", + "about_extra_1": "With years of experience in primary medicine, we focus on building lasting relationships with patients while addressing their complete health and wellness needs. ", + "about_extra_2": "Our practice welcomes patients of all ages and offers a full range of services from preventive care to chronic disease management. ", "contact_title": "Questions? Let's Talk", - "contact_introduction": "Want to learn more about us, or speak with an expert? Let us know what you are looking for and we’ll get back to you right away", + "contact_introduction": "Want to learn more about us, or speak with an expert? Let us know what you are looking for, and we’ll get back to you right away.", "internal_template_style": '' } # web_contents_data[""] = "" @@ -95,7 +96,7 @@ class WebContentsService(BaseService): latitude = data.get('latitude', '') longitude = data.get('longitude', '') - + WebContentsService.get_site_imges_data(provision_uid) membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid) if not membersSubResult: @@ -132,3 +133,41 @@ class WebContentsService(BaseService): except Exception as e: logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True) return jsonify({"message": "Internal Server Error"}), 500 + + @staticmethod + def get_site_imges_data(provision_uid): + + membersSubResult = MembersProducts.get_member_product_by_subscription_uid(provision_uid) + + if not membersSubResult: + return None + + destination_server = "http://"+ str(membersSubResult.primary_server)+":"+str(membersSubResult.provision_port) + api_url = destination_server + "/api" + try: + logger.info(f"api_url: {str(api_url)}") + # Make the GET request + response = requests.get(api_url) + + response_data = { + "provision_uid": provision_uid, + # "member_id": member_id, + # "product_id": product_id, + # "country": country, + # "region": region, + # "city": city, + # "latitude": latitude, + # "longitude": longitude, + } + + # logger.error(f"Going for Thread ******************** ") + # thread = Thread(target=MyProductsService.async_send_settings_refresh_to_kafka, + # args=(response_data, provision_uid, KafkaMessage.SITE_TRAFFIC_DATA)) + # thread.start() + # logger.error(f"After the Thread ******************** ") + + return response_data + + except Exception as e: + logger.error(f"An error occurred while get_site_imges_data data: {str(e)}", exc_info=True) + return None