diff --git a/app/api/services/contacts.py b/app/api/services/contacts.py index 422fedb..ce41d67 100644 --- a/app/api/services/contacts.py +++ b/app/api/services/contacts.py @@ -2,7 +2,7 @@ from app.utils.logger import logger from app.api.services.base_service import BaseService from marshmallow import ValidationError from app.extensions import db -from app.models import MembersProducts, Products, Members +from app.models import MembersProducts, Products, Members, ProductsContacts from app.api.helpers.response_helper import ResponseHelper from app.api.schemas.user import UserSchema @@ -34,7 +34,6 @@ class ContactService(BaseService): cat_list = ['A000002', 'A000004', 'A000001', 'A000003'] - dList = [] sample_range = random.randint(20, 60) for x in range(sample_range): @@ -94,15 +93,12 @@ class ContactService(BaseService): title = data.get('title', '') email = data.get('email', '') sender = data.get('sender', '') - memSubb = MembersProducts.get_member_product_by_subscription_uid(subscription_uid) + 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 + )