Contact retuen

This commit is contained in:
CHIEFSOFT\ameye
2026-05-16 08:13:54 -04:00
parent 970cf7e1e9
commit f3e7a746af
+17 -1
View File
@@ -127,17 +127,33 @@ class ContactService(BaseService):
@staticmethod @staticmethod
def process_save_contacts(data): def process_save_contacts(data):
logger.info(f"Process_save_contacts IN -> : {data}", exc_info=True) logger.info(f"Process_save_contacts IN -> : {data}", exc_info=True)
try:
message = data.get('message', '') message = data.get('message', '')
subscription_uid = data.get('subscription_uid', '') subscription_uid = data.get('subscription_uid', '')
title = data.get('title', '') title = data.get('title', '')
email = data.get('email', '') email = data.get('email', '')
sender = data.get('sender', '') sender = data.get('sender', '')
contact_result = []
memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid) memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid)
if memSubb: if memSubb:
member_id = memSubb.member_id, member_id = memSubb.member_id,
product_id = memSubb.product_id product_id = memSubb.product_id
if message != '' and title != '' and email != '' and sender != '': if message != '' and title != '' and email != '' and sender != '':
logger.info(f"Ready to save data: {data}", exc_info=True) logger.info(f"Ready to save data: {data}", exc_info=True)
ProductsContacts.add_product_contact( contact_result = ProductsContacts.add_product_contact(
member_id, product_id, subscription_uid, title, email, sender, message member_id, product_id, subscription_uid, title, email, sender, message
) )
response_data = {
"last_message": datetime.datetime.utcnow(),
"subscription_uid": subscription_uid,
"result": contact_result,
}
return ResponseHelper.success(data=response_data)
except Exception as e:
logger.error(f"An error occurred: {str(e)}", exc_info=True)
return ResponseHelper.internal_server_error()