product URL
This commit is contained in:
@@ -106,9 +106,18 @@ def merms_account_actions():
|
|||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_account_product_url():
|
def merms_account_product_url():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
response = ProductsService.process_request(data)
|
response = ProductsService.product_url_request(data)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@api.route("/panel/account/products/url", methods=["POST"])
|
||||||
|
def myproduct_url():
|
||||||
|
data = request.get_json()
|
||||||
|
logger.info(f"Route Product URL Data ==>>>> {data}")
|
||||||
|
response = ProductsService.product_url_request(data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@api.route("/panel/account/products", methods=["POST"])
|
@api.route("/panel/account/products", methods=["POST"])
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def merms_products():
|
def merms_products():
|
||||||
|
|||||||
@@ -76,19 +76,63 @@ class ProductsService(BaseService):
|
|||||||
'status_text': 'Activate Now'
|
'status_text': 'Activate Now'
|
||||||
})
|
})
|
||||||
|
|
||||||
# | prov_status | status_text
|
|
||||||
# products_data = [{
|
# Simulate processing
|
||||||
# 'id': t.id,
|
response_data = {
|
||||||
# 'uid': t.uid,
|
"products_data": product_data,
|
||||||
# 'product_id': t.product_id,
|
"member_id": 0,
|
||||||
# 'description': t.description,
|
"uid": 0,
|
||||||
# 'name': t.name,
|
}
|
||||||
# 'status': t.status,
|
|
||||||
# 'created_at': t.created_at.isoformat() if t.created_at else None,
|
return ResponseHelper.success(data=response_data)
|
||||||
# 'updated_at': t.updated_at.isoformat() if t.updated_at else None,
|
|
||||||
# 'banner': t.banner,
|
except ValidationError as err:
|
||||||
# } for t in products]
|
|
||||||
# "products_data22": products_data,
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def product_url_request(data):
|
||||||
|
|
||||||
|
try:
|
||||||
|
with db.session.begin():
|
||||||
|
|
||||||
|
validated_data = ProductsService.validate_data(data, UserSchema())
|
||||||
|
token = validated_data.get('token')
|
||||||
|
uid = validated_data.get('uid')
|
||||||
|
|
||||||
|
member_id = 1 # current_user["user"]["id"]
|
||||||
|
|
||||||
|
products = Products.get_user_product_list(member_id)
|
||||||
|
product_data=[]
|
||||||
|
logger.info(f"Product Data ****** *****: {products}")
|
||||||
|
|
||||||
|
for t in products:
|
||||||
|
product_data.append({
|
||||||
|
'id': t.id,
|
||||||
|
'uid': t.uid,
|
||||||
|
'product_id': t.product_id,
|
||||||
|
'description': t.description,
|
||||||
|
'name': t.name,
|
||||||
|
'status': t.status,
|
||||||
|
'added': t.added.isoformat() if t.added else None,
|
||||||
|
'updated': t.updated.isoformat() if t.updated else None,
|
||||||
|
'banner': t.banner,
|
||||||
|
'prov_status': '',
|
||||||
|
'status_text': 'Activate Now'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Simulate processing
|
# Simulate processing
|
||||||
|
|||||||
Reference in New Issue
Block a user