From 0119f701000f4192544c6eb1d99f81b72617b458 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 28 Sep 2025 08:09:09 -0400 Subject: [PATCH] office user --- app/api/services/office_dashboard.py | 3 ++- app/api/services/subscriptions.py | 1 + app/models/office_users.py | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/api/services/office_dashboard.py b/app/api/services/office_dashboard.py index 86bfcb5..5a96e64 100644 --- a/app/api/services/office_dashboard.py +++ b/app/api/services/office_dashboard.py @@ -97,7 +97,7 @@ class OfficeDashboardService(BaseService): "value": 159999.0 }, "payments": { - "currency": "Naira", + "currency": "Dollars", "currency_text": "\u0024", "text": "this week", "value": 0 @@ -217,6 +217,7 @@ class OfficeDashboardService(BaseService): member_sub_data.append({ 'id': subs.id, 'member_id': subs.member_id, + 'subscription_uid': str(subs.uid), 'product_id': subs.product_id, 'internal_url': subs.internal_url, 'external_url': subs.external_url, diff --git a/app/api/services/subscriptions.py b/app/api/services/subscriptions.py index 8aaa44b..47e64d0 100644 --- a/app/api/services/subscriptions.py +++ b/app/api/services/subscriptions.py @@ -41,6 +41,7 @@ class SubscriptionsService(BaseService): for subs in membersSubList: member_sub_data.append({ 'id': subs.id, + 'subscription_uid': str(subs.uid), 'member_id': subs.member_id, 'product_id': subs.product_id, 'internal_url': subs.internal_url, diff --git a/app/models/office_users.py b/app/models/office_users.py index c6f3eb2..5ac7acd 100644 --- a/app/models/office_users.py +++ b/app/models/office_users.py @@ -38,27 +38,30 @@ class OfficeUsers(db.Model): @classmethod def get_office_users_list(cls): users_list = cls.query.all() - if not users_list: raise ValueError(f"No available users") return users_list @classmethod def get_office_user_id(cls, user_id): - """ - Get customer's active loans by loan_id. - """ users_list = cls.query.filter_by(id=user_id).first() if not users_list: - # raise ValueError(f"pProduct with ID {product_id} does not exist.") logger.error(f"users_list with ID {user_id} does not exist.") return None return users_list + @classmethod + def get_office_user_by_username(cls, username): + logger.info(f"users_list looking for {username} .") + users_list = cls.query.filter_by(username=username).first() + logger.info(f"users_list looking for {username} after.") + if not users_list: + logger.error(f"users_list with ID {user_id} does not exist.") + return None + return users_list + + def to_dict(self): - """ - Convert the Loan object to a dictionary format for JSON serialization. - """ return { 'id': self.id, 'uid': self.uid,