Clean up URL
This commit is contained in:
@@ -28,6 +28,7 @@ from app.config import Config
|
||||
|
||||
class MyProductsService(BaseService):
|
||||
START_URL_PATTERN = Config.START_URL_PATTERN
|
||||
MEDIA_SERVER = Config.MEDIA_SERVER
|
||||
|
||||
@staticmethod
|
||||
def process_provision_actions(data):
|
||||
@@ -941,8 +942,6 @@ class MyProductsService(BaseService):
|
||||
"error": f"File with ID {image_id} does not exist."
|
||||
}, 400
|
||||
|
||||
|
||||
|
||||
if not product_data:
|
||||
return {
|
||||
"message": "Please provide valid product_id",
|
||||
@@ -951,12 +950,35 @@ class MyProductsService(BaseService):
|
||||
"error": f"Product with ID {product_id} does not exist."
|
||||
}, 400
|
||||
|
||||
product_description = ProductsDetails.get_product_details_with_product_id(product_id)
|
||||
productDataStatus = product_data.status
|
||||
# make this file
|
||||
file_url = (MyProductsService.MEDIA_SERVER + "/" + selectedFile.file_group + "/" + selectedFile.uid + "/" + selectedFile.filename).lower()
|
||||
|
||||
# result_file_list = MembersWebfiles.get_member_webfiles_by_member_id(member_id)
|
||||
# file_list = []
|
||||
# if result_file_list:
|
||||
# for t in result_file_list:
|
||||
# file_list.append({
|
||||
# 'id': t.id,
|
||||
# 'file_uid': t.uid,
|
||||
# 'member_id': t.member_id,
|
||||
# 'member_uid': t.member_uid,
|
||||
# 'file_group': t.file_group,
|
||||
# 'filename': t.filename,
|
||||
# 'save_filename': t.save_filename,
|
||||
# 'file_type': t.file_type,
|
||||
# 'status': t.status,
|
||||
# 'file_size': t.file_size,
|
||||
# 'added': t.added.isoformat() if t.added else None,
|
||||
# 'updated': t.updated.isoformat() if t.updated else None
|
||||
# })
|
||||
#
|
||||
# response_data = {
|
||||
# "file_list": file_list,
|
||||
# "media_server": settings.MEDIA_SERVER,
|
||||
# }
|
||||
|
||||
|
||||
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
|
||||
template_images = []
|
||||
template_name = ''
|
||||
|
||||
if memberSubscription is not None:
|
||||
custom_template = "" if (
|
||||
@@ -965,49 +987,16 @@ class MyProductsService(BaseService):
|
||||
|
||||
# logger.info(f"Incoming MyProduct data ==>>>> {memberSubscription}")
|
||||
product_subscription_uid = memberSubscription.uid
|
||||
subscription_template = "" if len(custom_template) > 0 else memberSubscription.product_template
|
||||
settingsFields = SettingsItemsData.get_site_settings_data()
|
||||
templateData = []
|
||||
# homeFields = SettingsItemsData.get_site_home_settings()
|
||||
# footerFields = SettingsItemsData.get_site_footer_settings()
|
||||
# contactFields = SettingsItemsData.get_site_contact_items()
|
||||
# socialFields = SettingsItemsData.get_site_social_settings_data()
|
||||
# aboutFields = SettingsItemsData.get_site_about_items()
|
||||
# testimonialFields = SettingsItemsData.get_site_testimonial_settings()
|
||||
# blogConnectFields = SettingsItemsData.get_site_blog_connect_settings()
|
||||
|
||||
blogConnect = False
|
||||
if product_data.blog_product_id != None and product_data.blog_product_id != '':
|
||||
blogConnect = True
|
||||
blog_product_data = Products.get_product_by_product_id(product_data.blog_product_id)
|
||||
|
||||
settings_items = {}
|
||||
selected_flavor = ''
|
||||
if product_id == "A000001" or product_id == "A000002": ## should be config or data driven not hard coded
|
||||
settings_items = {}
|
||||
|
||||
if memberSubscription.product_template:
|
||||
selectedTemplate = ProductsTemplates.get_template_by_uid(
|
||||
str(memberSubscription.product_template))
|
||||
if selectedTemplate:
|
||||
selected_flavor = selectedTemplate.flavor
|
||||
template_name = selectedTemplate.name
|
||||
|
||||
template_images = BaseService.get_site_imges_data(memberSubscription.uid,
|
||||
memberSubscription.primary_server,
|
||||
memberSubscription.provision_port,
|
||||
selected_flavor)
|
||||
|
||||
# Simulate processing
|
||||
response_data = {
|
||||
"settings_items": settings_items,
|
||||
"file_url": file_url,
|
||||
"product_id": product_id,
|
||||
"member_id": member_id,
|
||||
"subscription_template": str(subscription_template),
|
||||
"template_name": str(template_name),
|
||||
"product_subscription_uid": str(product_subscription_uid),
|
||||
"blog_connect": str(blogConnect),
|
||||
"template_images": template_images
|
||||
}
|
||||
|
||||
return ResponseHelper.success(data=response_data)
|
||||
|
||||
Reference in New Issue
Block a user