color style

This commit is contained in:
CHIEFSOFT\ameye
2025-10-19 08:39:46 -04:00
parent ee7004236e
commit 2baf7c9a55
7 changed files with 263 additions and 16 deletions
+1 -1
View File
@@ -79,6 +79,6 @@ class SettingsItemsData:
def get_site_blog_connect_settings():
data = {
"boolean_blog_connect_show": {"name": 'Show Blog Section', "controls": 'SELECT_NO_YES',
"active": True, "list_order": 0},
"active": True, "list_order": 0},
}
return data
+32 -1
View File
@@ -115,6 +115,7 @@ def merms_account():
response = AccountService.process_request(data)
return response
@api.route("/panel/account/profile", methods=["POST"])
@jwt_required()
def merms_account_profile():
@@ -189,6 +190,16 @@ def get_myproduct_templates():
return response
@api.route("/panel/account/products/color-styles", methods=["POST"])
# @token_required
def get_myproduct_colorstyles():
# Call the ColorStyles service
data = request.get_json()
# logger.info(f"Route Product ColorStyles Data ==>>>> {data}")
response = MyProductsService.mpproduct_colostyles_data(data)
return response
@api.route("/panel/account/template/activate", methods=["POST"])
# @token_required
def get_myproduct_templates_activate():
@@ -205,6 +216,7 @@ def merms_contacts():
response = ContactService.process_request(data)
return response
@api.route("/panel/comments", methods=["POST"])
def merms_site_comments():
data = request.get_json()
@@ -228,6 +240,7 @@ def myproduct_dash():
response = MyProductsService.process_request(data)
return response
@api.route("/panel/myproduct/external-url", methods=["POST"])
def set_external_url():
data = request.get_json()
@@ -382,6 +395,7 @@ def get_dashboard():
result = OfficeDashboardService.get_dashboard_data()
return jsonify(result)
@api.route('/office/country', methods=['GET'])
# @token_required
def get_office_country():
@@ -389,6 +403,7 @@ def get_office_country():
result = OfficeCountryService.get_office_country_list()
return jsonify(result)
@api.route('/office/set-country', methods=['POST'])
# @token_required
def set_office_country():
@@ -427,6 +442,7 @@ def get_subscriptions_list_office():
response = SubscriptionsService.get_subscription_data(filters)
return response
@api.route('/office/subscription-view', methods=['GET'])
# @token_required
def get_subcriptions_view_office():
@@ -438,6 +454,7 @@ def get_subcriptions_view_office():
response = OfficeDashboardService.get_subscription_view_data(filters)
return response
@api.route('/office/template/set-custom', methods=['POST'])
# @token_required
def get_set_custom_template_office():
@@ -464,6 +481,7 @@ def get_create_custom_template_office():
response = OfficeTemplatesService.create_custom_template(data)
return response
@api.route('/office/billings', methods=['GET'])
# @token_required
def get_subscription_billings_office():
@@ -490,6 +508,7 @@ def get_subscription_transaction_office():
result = OfficeDashboardService.get_payments_data(filters)
return jsonify(result)
@api.route('/office/recent-signup', methods=['GET'])
def get_recent_signup_office():
# Call the dashboard service
@@ -497,6 +516,7 @@ def get_recent_signup_office():
result = OfficeDashboardService.get_payments_data(filters)
return jsonify(result)
@api.route('/office/right-sidebar', methods=['GET'])
def get_office_sidebar():
# Call the dashboard service
@@ -504,6 +524,7 @@ def get_office_sidebar():
result = OfficeDashboardService.get_office_sidebar(filters)
return jsonify(result)
@api.route('/office/users', methods=['GET'])
def get_office_users():
logger.info('API::get office users')
@@ -511,6 +532,7 @@ def get_office_users():
result = OfficeUsersService.get_office_users(filters)
return jsonify(result)
@api.route('/office/products', methods=['GET'])
def get_product_office():
# Call the dashboard service
@@ -518,6 +540,7 @@ 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
@@ -527,6 +550,7 @@ def get_product_view_office():
result = OfficeDashboardService.get_office_product_detail(filters)
return jsonify(result)
@api.route('/office/product-update', methods=['POST'])
def get_product_update_office():
# Call the dashboard service
@@ -556,6 +580,7 @@ def get_product_templates():
result = OfficeDashboardService.get_office_product_templates(filters)
return jsonify(result)
@api.route('/office/account-view', methods=['GET'])
def get_office_accoint_view():
# Call the office account viiew
@@ -568,6 +593,7 @@ def get_office_accoint_view():
# return response
return jsonify(response)
@api.route('/office/custom-templates', methods=['GET'])
def get_custom_templates():
# Call the dashboard service
@@ -581,6 +607,7 @@ def get_custom_templates():
result = OfficeDashboardService.get_office_custom_templates(filters)
return jsonify(result)
# =====================================================
@api.route('/web/contents', methods=['GET'])
# @token_required
@@ -590,6 +617,7 @@ def get_web_contents():
result = WebContentsService.get_web_contents_data(provision_uid)
return jsonify(result)
# =====================================================
@api.route('/web/contacts', methods=['POST'])
# @token_required
@@ -599,6 +627,7 @@ def get_web_receive_contacts():
result = ContactService.process_save_contacts(data)
return jsonify(result)
# =====================================================
@api.route('/web/generatives', methods=['GET'])
def get_refresh_generatives():
@@ -608,6 +637,7 @@ def get_refresh_generatives():
result = GenerativesService.process_generatives_list(data)
return jsonify(result)
# =====================================================
@api.route('/web/traffic', methods=['POST'])
# @token_required
@@ -636,10 +666,11 @@ def common_practice():
# Health Check Endpoint
@api.route("/testemail", methods=["GET"])
def email_check():
data ={}
data = {}
AccountService.process_test_email(data)
return {"status": "ok"}, 200
# Health Check Endpoint
@api.route("/health", methods=["GET"])
def health_check():
+58 -1
View File
@@ -10,7 +10,7 @@ from app.api.services.base_service import BaseService
from marshmallow import ValidationError
from app.extensions import db
from app.models import MembersProducts, Products, Members, ProductsDetails, ProductsDetails, ProvisionActions, \
MembersProductsSettings, ProductsTemplates, MembersProfile, SubscriptionGenerative
MembersProductsSettings, ProductsTemplates, MembersProfile, SubscriptionGenerative, ProductsColorStyle
from app.api.helpers.response_helper import ResponseHelper
from app.api.schemas.myproduct import MyProductSchema
from app.api.schemas.provision import ProvisionSchema
@@ -124,6 +124,63 @@ class MyProductsService(BaseService):
db.session.rollback()
return ResponseHelper.internal_server_error()
@staticmethod
def mpproduct_colostyles_data(data):
try:
with db.session.begin():
# logger.info(f"Incoming MyProduct data ==>>>> {data}")
validated_data = MyProductsService.validate_data(data, MyProductSchema())
token = validated_data.get('token')
uid = validated_data.get('uid')
member_data = Members.get_member_by_uid(uid)
member_id = member_data.id
product_id = validated_data.get('product_id')
color_style_data = []
memberSubscription = MembersProducts.get_member_product_by_product_member_id(member_id, product_id)
if memberSubscription:
colorStyles = ProductsColorStyle.get_colorstyle_by_product_id(product_id)
# templates = ProductsTemplates.get_template_by_product_id(product_id)
for t in colorStyles:
color_style_data.append({
'id': t.id,
'template_uid': t.uid,
'color_style_uid': t.uid,
'color_code': t.color_code,
'title': t.name,
'active': t.status,
'added': t.added.isoformat() if t.added else None
})
response_data = {
"product_id": product_id,
"current_template_uid": memberSubscription.product_template if memberSubscription else None,
"custom_template_name": memberSubscription.custom_template if memberSubscription else '',
"templates": color_style_data,
"last_update": datetime.datetime.utcnow(),
}
return ResponseHelper.success(data=response_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()
@staticmethod
def process_provision(data):
try: