custom data

This commit is contained in:
CHIEFSOFT\ameye
2025-09-28 15:29:06 -04:00
parent 0119f70100
commit 53e2171e0b
3 changed files with 23 additions and 10 deletions
+20 -9
View File
@@ -6,7 +6,7 @@ from app.api.services.base_service import BaseService
from sqlalchemy import func, desc
from datetime import datetime, timedelta, timezone
from app.extensions import db
from app.models import MembersProducts, Products, Payments, Members, CustomTemplates, ProductsTemplates
from app.models import MembersProducts, Products, Payments, Members, CustomTemplates, ProductsTemplates, MembersProfile
class OfficeDashboardService(BaseService):
@@ -207,7 +207,9 @@ class OfficeDashboardService(BaseService):
"trial_end": account_result.trial_end,
}
# "profile_completed": account_result.profile_completed,
member_id = account_result.id
logger.info(f"member_id :: member_uid: {member_id} :: {member_uid} ")
# "profile_comp leted": account_result.profile_completed,
# "next_billing": account_result.next_billing,
membersSubList = MembersProducts.get_member_productlist_by_member_id(account_result.id)
@@ -223,11 +225,12 @@ class OfficeDashboardService(BaseService):
'external_url': subs.external_url,
'dns_group': subs.dns_group,
'status': subs.status,
'product_template': subs.product_template,
'custom_template': subs.custom_template,
'updated': subs.updated,
"added": subs.added,
})
member_payments = Payments.get_member_payments_by_member_id(account_result.id)
member_payments_data = []
@@ -243,11 +246,23 @@ class OfficeDashboardService(BaseService):
'status': t.status,
'added': t.added
})
account_profile_data = []
current_profile = MembersProfile.get_member_profile_by_member_id(member_id)
if current_profile is None:
account_profile_data = []
else:
account_profile_data = {
'id': current_profile.id,
'profile_uid': current_profile.uid,
'member_id': current_profile.member_id,
'practice': current_profile.practice,
'specialization': current_profile.specialization,
'url_name': current_profile.url_name
}
account_result = {
"account": account_data,
"account_profile": {},
"account_profile": account_profile_data,
"subscriptions": member_sub_data,
"payments": member_payments_data
}
@@ -258,7 +273,3 @@ class OfficeDashboardService(BaseService):
except Exception as e:
logger.error(f"An error occurred while getting cusomer data: {str(e)}", exc_info=True)
return jsonify({"message": "Internal Server Error"}), 500