Contact Files
This commit is contained in:
@@ -37,9 +37,9 @@ class ContactService(BaseService):
|
|||||||
limit = 20
|
limit = 20
|
||||||
|
|
||||||
dList = []
|
dList = []
|
||||||
contatsData = ProductsContacts.get_all_contacts(member_id, page=1, limit=20)
|
contacts_data , total_count= ProductsContacts.get_all_contacts(member_id, page=1, limit=20)
|
||||||
if contatsData:
|
if contacts_data:
|
||||||
for t in contatsData:
|
for t in contacts_data:
|
||||||
new_l = {
|
new_l = {
|
||||||
"uid": str(t.uid),
|
"uid": str(t.uid),
|
||||||
"title": t.title,
|
"title": t.title,
|
||||||
@@ -50,6 +50,21 @@ class ContactService(BaseService):
|
|||||||
}
|
}
|
||||||
dList.append(new_l)
|
dList.append(new_l)
|
||||||
|
|
||||||
|
# membersSubList, total_count = MembersProducts.get_all_subscriptions(product_id, member_id, page, limit)
|
||||||
|
# # Convert loans to dictionary format
|
||||||
|
# member_sub_data = []
|
||||||
|
# for subs in membersSubList:
|
||||||
|
# member_sub_data.append({
|
||||||
|
# 'id': subs.id,
|
||||||
|
# 'member_id': subs.member_id,
|
||||||
|
# 'product_id': subs.product_id,
|
||||||
|
# 'internal_url': subs.internal_url,
|
||||||
|
# 'external_url': subs.external_url,
|
||||||
|
# 'dns_group': subs.dns_group,
|
||||||
|
# 'status': subs.status,
|
||||||
|
# 'updated': subs.updated,
|
||||||
|
# "added": subs.added,
|
||||||
|
# })
|
||||||
|
|
||||||
# sample_range = random.randint(20, 60)
|
# sample_range = random.randint(20, 60)
|
||||||
# for x in range(sample_range):
|
# for x in range(sample_range):
|
||||||
@@ -63,12 +78,20 @@ class ContactService(BaseService):
|
|||||||
# "message": ContactService.dummy_message()
|
# "message": ContactService.dummy_message()
|
||||||
# }
|
# }
|
||||||
# dList.append(new_l)
|
# dList.append(new_l)
|
||||||
|
total_pages = (total_count + limit - 1) // limit
|
||||||
response_data = {
|
response_data = {
|
||||||
"last_update": datetime.datetime.utcnow(),
|
"last_update": datetime.datetime.utcnow(),
|
||||||
"member_id": member_id,
|
"member_id": member_id,
|
||||||
"category": category_data,
|
"category": category_data,
|
||||||
"contacts": dList
|
"contacts": dList,
|
||||||
|
'pagination': {
|
||||||
|
'total_count': total_count,
|
||||||
|
'total_pages': total_pages,
|
||||||
|
'current_page': page,
|
||||||
|
'limit': limit,
|
||||||
|
'has_next': page < total_pages,
|
||||||
|
'has_prev': page > 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseHelper.success(data=response_data)
|
return ResponseHelper.success(data=response_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user