From e06948643a407a73fa03b3961816f26f65ac41f6 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 7 Oct 2025 12:29:43 -0400 Subject: [PATCH] offcie product --- app/api/routes/routes.py | 9 +++++ app/api/services/account.py | 53 ++++++++++++++++++++++++++++ app/api/services/office_dashboard.py | 24 +++++++++++++ 3 files changed, 86 insertions(+) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 6f47ee4..e9b9d9a 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -518,6 +518,15 @@ def get_product_office(): result = OfficeDashboardService.get_office_products(filters) return jsonify(result) +@api.route('/office/product-view', methods=['GET']) +def get_product_view_office(): + # Call the dashboard service + filters = { + 'product_id': request.args.get('product_id') + } + result = OfficeDashboardService.get_office_product_detail(filters) + return jsonify(result) + @api.route('/office/products-templates', methods=['GET']) def get_product_templates(): # Call the dashboard service diff --git a/app/api/services/account.py b/app/api/services/account.py index 2d724f1..8e85593 100644 --- a/app/api/services/account.py +++ b/app/api/services/account.py @@ -538,3 +538,56 @@ class AccountService(BaseService): logger.error(f"Error sending email: {e}") finally: server.quit() # Close the connection + + + # @staticmethod + # def get_profile_data(data): + # + # try: + # with db.session.begin(): + # + # validated_data = AccountService.validate_data(data, UserSchema()) + # user_token = validated_data.get('token') + # uid = str(validated_data.get('uid')) + # member_data = Members.get_member_by_uid(uid) + # + # personal_data = { + # "firstname": member_data.firstname, + # "lastname": member_data.lastname, + # "account_name": member_data.account_name, + # "phone": "911 111 1111", + # "full_address": "100 White House, Washington, DC 00000", + # "country": member_data.country, + # } + # + # external_links = { + # "facebook_url": "facebook.com", + # "twitter_url": "twitter.com", + # "blogger_url": "blogger.com", + # "google_url": "google.com", + # "linked_url": "linkedin.com", + # "website_url": "www.mysite.com", + # } + # + # profile_data = { + # "personal_data": personal_data, + # "external_links": external_links, + # } + # + # return ResponseHelper.success(data=profile_data) + # + # except ValidationError as err: + # + # logger.error(f"Validation Error: {getattr(err, 'messages', str(err))}") + # db.session.rollback() + # return ResponseHelper.unprocessable_entity(result_description="Validation exception") + # + # except ValueError as err: + # logger.error(f"{getattr(err, 'messages', str(err))}") + # db.session.rollback() + # return ResponseHelper.error(result_description=str(err)) + # + # except Exception as e: + # logger.error(f"An error occurred: {str(e)}", exc_info=True) + # db.session.rollback() + # return ResponseHelper.internal_server_error() diff --git a/app/api/services/office_dashboard.py b/app/api/services/office_dashboard.py index a4579ad..401d787 100644 --- a/app/api/services/office_dashboard.py +++ b/app/api/services/office_dashboard.py @@ -152,6 +152,30 @@ class OfficeDashboardService(BaseService): return products_result + @staticmethod + def get_office_product_detail(filters): + product_id = filters.get('product_id') + products = Products.get_product_by_product_id(product_id) + product_data = { + 'id': products.id, + 'uid': products.uid, + 'product_id': products.product_id, + 'description': products.description, + 'name': products.name, + 'status': products.status, + 'added': products.added.isoformat() if products.added else None, + 'updated': products.updated.isoformat() if products.updated else None, + 'banner': products.banner, + } + + + products_result = { + "product_configuration": product_data, + "product_details": product_data, + } + + return products_result + @staticmethod def get_office_product_templates(filters): templates = ProductsTemplates.get_template_for_office(filters)