From 52a0a72702e9d8f63961a76c25847bbbe917bb0a Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 14 Sep 2025 06:37:41 -0400 Subject: [PATCH] add contacts rourtes --- SQL/site_data.sql | 28 ++++++++++++++++ app/api/routes/routes.py | 8 +++++ app/api/services/contacts.py | 24 +++++++++----- app/api/services/myproduct.py | 62 +++++++++++++++++++---------------- 4 files changed, 84 insertions(+), 38 deletions(-) diff --git a/SQL/site_data.sql b/SQL/site_data.sql index 541b35b..55eb726 100644 --- a/SQL/site_data.sql +++ b/SQL/site_data.sql @@ -635,6 +635,34 @@ ALTER TABLE ONLY office_users ALTER TABLE office_users OWNER TO merms_panel; +CREATE TABLE products_contacts( + id SERIAL, + uid uuid DEFAULT uuid_generate_v4(), + username VARCHAR(25) UNIQUE NOT NULL, + product_id VARCHAR(25) NOT NULL, + subscription_uid VARCHAR(100) NOT NULL, + title VARCHAR(100) NOT NULL, + sender VARCHAR(120) NOT NULL, + message TEXT, + status INT DEFAULT 0, + added timestamp without time zone DEFAULT now() +); + +ALTER TABLE ONLY products_contacts + ADD CONSTRAINT products_contacts_id_key UNIQUE (id); + +ALTER TABLE products_contacts OWNER TO merms_panel; + + + new_l = { + "uid": "425611f2-c692-4404-b93d-76ca7a5ce7" + str(x), + "title": "Contact Random Item on " + str(x), + "category": cat_list[random.randint(0, 3)], + "added": calDate, + "sender": "Firstname Lastname" + str(random.randint(1, 4)), + "message": dummy_message() + } + diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 61cfc87..9b03b0c 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -468,6 +468,14 @@ def get_web_contents(): result = WebContentsService.get_web_contents_data(provision_uid) return jsonify(result) +# ===================================================== +@api.route('/web/contacts', methods=['POST']) +# @token_required +def get_web_receive_contacts(): + # Call the dashboard service + data = request.get_json() + result = ContactService.process_save_contacts(data) + return jsonify(result) # ===================================================== @api.route('/web/generatives', methods=['GET']) diff --git a/app/api/services/contacts.py b/app/api/services/contacts.py index 06675ac..4454b73 100644 --- a/app/api/services/contacts.py +++ b/app/api/services/contacts.py @@ -57,7 +57,7 @@ class ContactService(BaseService): "category": cat_list[random.randint(0, 3)], "added": calDate, "sender": "Firstname Lastname" + str(random.randint(1, 4)), - "message": dummy_message() + "message": ContactService.dummy_message() } dList.append(new_l) @@ -87,13 +87,19 @@ class ContactService(BaseService): return ResponseHelper.internal_server_error() -def dummy_message(): - dmm = "Dmummy Message" + str(random.randint(100, 400)) - mss = f""" - {dmm}I truly believe Augustine’s words are true and if you look at history you know it is true. There are many people in the world with amazing talents who realize only a small percentage of their potential. We all know people who live this truth. - We also know those epic stories, those modern-day legends surrounding the early failures of such supremely successful folks as Michael Jordan and Bill Gates. We can look a bit further back in time to Albert Einstein or even further back to Abraham Lincoln. What made each of these people so successful? Motivation. + def dummy_message(): + dmm = "Dmummy Message" + str(random.randint(100, 400)) + mss = f""" + {dmm}I truly believe Augustine’s words are true and if you look at history you know it is true. There are many people in the world with amazing talents who realize only a small percentage of their potential. We all know people who live this truth. + + We also know those epic stories, those modern-day legends surrounding the early failures of such supremely successful folks as Michael Jordan and Bill Gates. We can look a bit further back in time to Albert Einstein or even further back to Abraham Lincoln. What made each of these people so successful? Motivation. + + We know this in our gut, but what can we do about it? How can we motivate ourselves? One of the most difficult aspects of achieving success is staying motivated over the long haul. + """ + return mss + + @staticmethod + def process_save_contacts(data): + pass - We know this in our gut, but what can we do about it? How can we motivate ourselves? One of the most difficult aspects of achieving success is staying motivated over the long haul. - """ - return mss diff --git a/app/api/services/myproduct.py b/app/api/services/myproduct.py index b4f2771..cb6924d 100644 --- a/app/api/services/myproduct.py +++ b/app/api/services/myproduct.py @@ -510,41 +510,19 @@ class MyProductsService(BaseService): settings_items = {} if product_id == "A000001": settings_items = { + "url_config_tab": {"title": 'URL Configuration', "controls": 'url-config', "active": '', + "custom": True, "data": {}, "list_order": 0}, "settings": {"title": 'Settings', "controls": 'settings', "active": 'active show', - "custom": False, "data": settingsFields, "list_order": 0}, + "custom": False, "data": settingsFields, "list_order": 1}, "home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False, - "data": homeFields, "list_order": 1}, + "data": homeFields, "list_order": 2}, "footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False, - "data": footerFields, "list_order": 2}, + "data": footerFields, "list_order": 3}, "about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False, - "data": aboutFields, "list_order": 3}, + "data": aboutFields, "list_order": 4}, "contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '', "custom": False, - "data": contactFields, "list_order": 4}, - "social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False, - "data": socialFields, "list_order": 5}, - "template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True, - "data": templateData, "list_order": 6}, - "color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '', - "custom": True, "data": {}, "list_order": 7} - } - - if product_id == "A000002": - settings_items = { - "settings": {"title": 'Settings', "controls": 'settings', "active": 'active show', - "custom": False, "data": settingsFields, "list_order": 0}, - "home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False, - "data": homeFields, "list_order": 1}, - "footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False, - "data": footerFields, "list_order": 2}, - "about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False, - "data": aboutFields, "list_order": 3}, - "contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '', - "custom": False, - "data": contactFields, "list_order": 4}, - "testimonial_tab": {"title": 'Testimonials', "controls": 'testimonial', "active": '', - "custom": False, - "data": testimonialFields, "list_order": 5}, + "data": contactFields, "list_order": 5}, "social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False, "data": socialFields, "list_order": 6}, "template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True, @@ -552,6 +530,32 @@ class MyProductsService(BaseService): "color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '', "custom": True, "data": {}, "list_order": 8} } + + if product_id == "A000002": + settings_items = { + "url_config_tab": {"title": 'URL Configuration', "controls": 'url-config', "active": '', + "custom": True, "data": {}, "list_order": 0}, + "settings": {"title": 'Settings', "controls": 'settings', "active": 'active show', + "custom": False, "data": settingsFields, "list_order": 1}, + "home_tab": {"title": 'Home Page', "controls": 'home', "active": '', "custom": False, + "data": homeFields, "list_order": 2}, + "footer_tab": {"title": 'Footer', "controls": 'footer', "active": '', "custom": False, + "data": footerFields, "list_order": 3}, + "about_tab": {"title": 'About Page', "controls": 'about', "active": '', "custom": False, + "data": aboutFields, "list_order": 4}, + "contact_tab": {"title": 'Contact Page', "controls": 'contact', "active": '', + "custom": False, + "data": contactFields, "list_order": 5}, + "testimonial_tab": {"title": 'Testimonials', "controls": 'testimonial', "active": '', + "custom": False, + "data": testimonialFields, "list_order": 6}, + "social_tab": {"title": 'Socials', "controls": 'social', "active": '', "custom": False, + "data": socialFields, "list_order": 7}, + "template_tab": {"title": 'Template', "controls": 'template', "active": '', "custom": True, + "data": templateData, "list_order": 8}, + "color_scheme_tab": {"title": 'Color Scheme', "controls": 'color-scheme', "active": '', + "custom": True, "data": {}, "list_order": 8} + } # # Simulate processing