offcie product
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user