Contact Files

This commit is contained in:
2026-05-15 12:40:52 -04:00
parent 570061caef
commit ceed7fd066
+28 -5
View File
@@ -37,9 +37,9 @@ class ContactService(BaseService):
limit = 20
dList = []
contatsData = ProductsContacts.get_all_contacts(member_id, page=1, limit=20)
if contatsData:
for t in contatsData:
contacts_data , total_count= ProductsContacts.get_all_contacts(member_id, page=1, limit=20)
if contacts_data:
for t in contacts_data:
new_l = {
"uid": str(t.uid),
"title": t.title,
@@ -50,6 +50,21 @@ class ContactService(BaseService):
}
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)
# for x in range(sample_range):
@@ -63,12 +78,20 @@ class ContactService(BaseService):
# "message": ContactService.dummy_message()
# }
# dList.append(new_l)
total_pages = (total_count + limit - 1) // limit
response_data = {
"last_update": datetime.datetime.utcnow(),
"member_id": member_id,
"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)