From c3d7e62f7753150f22bd1013aa580c2b816d5b99 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 24 Jul 2025 05:25:05 -0400 Subject: [PATCH] Fix data --- app/api/services/login.py | 10 +++++----- app/api/services/myproduct.py | 10 ++++++++-- app/api/services/office_dashboard.py | 17 +++++++++++++++-- app/api/services/products.py | 21 +++++++++++++++++---- app/models/members_products.py | 2 +- 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/app/api/services/login.py b/app/api/services/login.py index 2dd2423..7b32463 100644 --- a/app/api/services/login.py +++ b/app/api/services/login.py @@ -30,19 +30,19 @@ class LoginService(BaseService): member = Members.get_member_by_username(username) if not member: invalid_data = { - "error_message": "invalid username or password", + "error_message": "You will get email to continue the process if the account is valid", + "reset_message": "", "message_key": "invalid_username_or_password", } return ResponseHelper.success(data=invalid_data) - reset_data = PasswordReset.create_reset(username=username) - BaseService.send_resetpass_mail(member.email, str(member.uid), member.id, "FF","LL") #pending_uid, pending_id, firstname, lastname response_data = { - "error_message": "invalid username or password 000", - "message_key": "invalid_username_or_password", + "error_message": "", + "reset_message": "Check your email to continue password reset.", + "message_key": "check_your_email_message", } return ResponseHelper.success(data=response_data) diff --git a/app/api/services/myproduct.py b/app/api/services/myproduct.py index 0ff9c86..8a3b4c0 100644 --- a/app/api/services/myproduct.py +++ b/app/api/services/myproduct.py @@ -188,10 +188,13 @@ class MyProductsService(BaseService): merms_panel=# "Product Description - Commitment is something that comes from understanding that everything has its price and then having the willingness to pay that price. This is important because nobody wants to put significant effort into something, only to find out after the fact that the price was too high.The price is something not necessarily defined as financial. It could be time, effort, sacrifice, money or perhaps, something else.", - + 'internal_url': self.internal_url, + 'external_url': self.external_url, ''' product_subscription_uid='' + product_subscription_external_url = '' + product_subscription_internal_url = '' product_data = Products.get_product_by_product_id(product_id) product_description = ProductsDetails.get_product_details_with_product_id('A000002') productDataStatus = product_data.status @@ -201,6 +204,8 @@ class MyProductsService(BaseService): logger.info(f"Incoming MyProduct data ==>>>> {memberSubscription}") productDataStatus = memberSubscription.status product_subscription_uid = memberSubscription.uid + product_subscription_external_url = memberSubscription.external_url + product_subscription_internal_url = memberSubscription.internal_url # "banner": "banner.jpg", @@ -209,7 +214,8 @@ class MyProductsService(BaseService): "banner": product_data.banner, "description": product_description.details, "sale_text" : product_description.sale_text, - "internal_url": "", + "internal_url": product_subscription_internal_url, + "external_url": product_subscription_external_url, "price_text": "90 days free and 3.95/Month", "product_id": product_data.product_id, "product_name": product_data.name, diff --git a/app/api/services/office_dashboard.py b/app/api/services/office_dashboard.py index b0eeac3..d8df289 100644 --- a/app/api/services/office_dashboard.py +++ b/app/api/services/office_dashboard.py @@ -100,13 +100,26 @@ class OfficeDashboardService(BaseService): # "recent_transactions": recent_transactions_data # } subscription = MembersProducts.get_dash_recent_subscription(15) - dashboard_data = { + subscription_data = [{ + 'id': t.id, + 'uid': t.uid, + 'product_id': t.product_id, + 'internal_url': t.internal_url, + 'external_url': t.external_url, + 'dns_group': t.dns_group, + 'status': t.status, + 'added': t.added, + 'updated': t.updated + } for t in subscription] + + dashboard_data = { + "subscription":subscription_data, "loans": { "currency": "Naira", "currency_text": "\u20a6", "text": "this week", - "value": 15000.0 + "value": 159999.0 }, "payments": { "currency": "Naira", diff --git a/app/api/services/products.py b/app/api/services/products.py index c74d964..51ab53b 100644 --- a/app/api/services/products.py +++ b/app/api/services/products.py @@ -35,22 +35,35 @@ class ProductsService(BaseService): member_data = Members.get_member_by_uid(uid) member_id = member_data.id # get user subscription - member_subs = MembersProducts.get_member_productlist_by_member_id(member_id) + member_subs_data =[] + product_status=[] + + # member_subs = MembersProducts.get_member_productlist_by_member_id(member_id) + # for t in member_subs: + # member_subs_data.append({ + # 'product_id': t.product_id, + # 'status': t.status, + # 'internal_url': t.internal_url, + # 'dns_group': t.dns_group, + # }) + # product_status[t.product_id] = t.status + products = Products.get_user_product_list(member_id) product_data=[] logger.info(f"Product Data ****** *****: {products}") for t in products: + currentStatus = t.status st_text = "Activate Now" # match str(t.status): - if t.status == 1: + if currentStatus == 1: st_text = "Coming Soon" - if t.status == 5: + if currentStatus == 5: st_text = "Activate Now" - if t.status == 6: + if currentStatus == 6: st_text = "Creating" diff --git a/app/models/members_products.py b/app/models/members_products.py index 96c3193..2d1ad3d 100644 --- a/app/models/members_products.py +++ b/app/models/members_products.py @@ -51,7 +51,7 @@ class MembersProducts(db.Model): @classmethod def get_dash_recent_subscription(cls, limit): - member_product = cls.query.limit(limit).all() + member_product = cls.query.order_by(cls.id.desc()).limit(limit).all() if not member_product: return None return member_product