Contact retuen

This commit is contained in:
CHIEFSOFT\ameye
2026-05-16 08:13:54 -04:00
parent 970cf7e1e9
commit f3e7a746af
+30 -14
View File
@@ -127,17 +127,33 @@ class ContactService(BaseService):
@staticmethod
def process_save_contacts(data):
logger.info(f"Process_save_contacts IN -> : {data}", exc_info=True)
message = data.get('message', '')
subscription_uid = data.get('subscription_uid', '')
title = data.get('title', '')
email = data.get('email', '')
sender = data.get('sender', '')
memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid)
if memSubb:
member_id = memSubb.member_id,
product_id = memSubb.product_id
if message != '' and title != '' and email != '' and sender != '':
logger.info(f"Ready to save data: {data}", exc_info=True)
ProductsContacts.add_product_contact(
member_id, product_id, subscription_uid, title, email, sender, message
)
try:
message = data.get('message', '')
subscription_uid = data.get('subscription_uid', '')
title = data.get('title', '')
email = data.get('email', '')
sender = data.get('sender', '')
contact_result = []
memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid)
if memSubb:
member_id = memSubb.member_id,
product_id = memSubb.product_id
if message != '' and title != '' and email != '' and sender != '':
logger.info(f"Ready to save data: {data}", exc_info=True)
contact_result = ProductsContacts.add_product_contact(
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()