fix contacts
This commit is contained in:
@@ -35,37 +35,17 @@ class ContactService(BaseService):
|
||||
member_data = Members.get_member_by_uid(uid)
|
||||
member_id = member_data.id
|
||||
|
||||
contacts_product_list = Products.get_contact_supported_product_list(member_id)
|
||||
category_data = []
|
||||
for t in contacts_product_list:
|
||||
category_data.append({
|
||||
'cid': t.product_id,
|
||||
'category_uid': t.uid,
|
||||
'description': t.name,
|
||||
})
|
||||
|
||||
cat_list = ['A000002', 'A000004', 'A000001', 'A000003']
|
||||
|
||||
category_data = [
|
||||
{
|
||||
"cid": "1",
|
||||
"description": "category 01"
|
||||
},
|
||||
{
|
||||
"cid": "2",
|
||||
"description": "category 02"
|
||||
},
|
||||
{
|
||||
"cid": "3",
|
||||
"description": "category 03"
|
||||
},
|
||||
{
|
||||
"cid": "4",
|
||||
"description": "category 04"
|
||||
}
|
||||
]
|
||||
|
||||
# SUPPORTED_CATEGORY = "SELECT name AS title,product_id from products WHERE product_id IN ('A000002','A000004','A000001','A000003')"
|
||||
# with connection:
|
||||
# with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
# cursor.execute(SUPPORTED_CATEGORY)
|
||||
# select_Res = cursor.fetchall()
|
||||
#
|
||||
# print(select_Res)
|
||||
# contacts_category = json.dumps([dict(ix) for ix in select_Res])
|
||||
# print(contacts_category)
|
||||
# array_cat = json.loads(contacts_category)
|
||||
|
||||
dList = []
|
||||
sample_range = random.randint(20, 60)
|
||||
@@ -83,7 +63,7 @@ class ContactService(BaseService):
|
||||
|
||||
response_data = {
|
||||
"last_update": datetime.datetime.utcnow(),
|
||||
"member_id":member_id,
|
||||
"member_id": member_id,
|
||||
"category": category_data,
|
||||
"contacts": dList
|
||||
}
|
||||
@@ -106,8 +86,9 @@ class ContactService(BaseService):
|
||||
db.session.rollback()
|
||||
return ResponseHelper.internal_server_error()
|
||||
|
||||
|
||||
def dummy_message():
|
||||
dmm = "Dmummy Message" + str(random.randint(100, 400))
|
||||
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.
|
||||
|
||||
@@ -115,4 +96,4 @@ def dummy_message():
|
||||
|
||||
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
|
||||
return mss
|
||||
|
||||
@@ -68,6 +68,18 @@ class Products(db.Model):
|
||||
logger.info(json_output)
|
||||
return json_output
|
||||
|
||||
@classmethod
|
||||
def get_contact_supported_product_list(cls, member_id):
|
||||
"""
|
||||
Return all offers in dictionary format.
|
||||
"""
|
||||
product_list = cls.query.all()
|
||||
|
||||
if not product_list:
|
||||
raise ValueError(f"No available Products")
|
||||
return product_list
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_user_product_list(cls, member_id):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user