From 19afb52c53c6e6f02cf67e6d77d655c55a42fa40 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Fri, 4 Jul 2025 10:29:32 -0400 Subject: [PATCH] fix cile --- app/api/schemas/myproduct.py | 7 ++++ app/api/services/myproduct.py | 60 +++++++++++++---------------------- 2 files changed, 29 insertions(+), 38 deletions(-) create mode 100644 app/api/schemas/myproduct.py diff --git a/app/api/schemas/myproduct.py b/app/api/schemas/myproduct.py new file mode 100644 index 0000000..15f7d26 --- /dev/null +++ b/app/api/schemas/myproduct.py @@ -0,0 +1,7 @@ +from marshmallow import Schema, fields + +class MyProductSchema(Schema): + token = fields.Str(required=True) + uid = fields.Str(required=True) + product_id = fields.Str(required=True) + diff --git a/app/api/services/myproduct.py b/app/api/services/myproduct.py index 079669c..b543547 100644 --- a/app/api/services/myproduct.py +++ b/app/api/services/myproduct.py @@ -14,7 +14,7 @@ from app.api.helpers.response_helper import ResponseHelper from werkzeug.security import generate_password_hash, check_password_hash # from app.api.schemas.register import RegisterSchema from app.api.schemas.products import ProductsSchema -from app.api.schemas.user import UserSchema +from app.api.schemas.myproduct import MyProductSchema import datetime import jwt @@ -29,49 +29,33 @@ class MyProductsService(BaseService): try: with db.session.begin(): - validated_data = MyProductsService.validate_data(data, UserSchema()) + validated_data = MyProductsService.validate_data(data, MyProductSchema()) token = validated_data.get('token') uid = validated_data.get('uid') + product_id = validated_data.get('product_id') - # product_id = request.args.get('product_id') - # print(product_id) - # if not product_id: - # return { - # "message": "Please provide product_id", - # "data": None, - # "error": "Bad request" - # }, 400 - # - # print(product_id) - # member_id = current_user['user']['member_id'] - # myproduct_data = myproduct_detail(member_id, product_id) - - - 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' - }) + myproduct_data = { + "myproudct": { + "banner": "banner.jpg", + "description": "Product Description - Commitment is something that comes from understanding that everything has its price and then having the willingness to pay that price. This is important because nobody wants to put significant effort into something, only to find out after the fact that the price was too high.The price is something not necessarily defined as financial. It could be time, effort, sacrifice, money or perhaps, something else.", + "internal_url": "", + "price_text": "90 days free and 3.95/Month", + "product_id": "A000001", + "product_name": "Personal Website", + "product_subscription_uid": "", + "product_uid": "77b479d2-48c6-491a-8c05-b5debf1557a3", + "promotion_text": "Start Free Today !", + "status": 1, + "subscription_text": "Start with your goals in mind and then work possible.ith yand Goals. If the plan doesn\u2019t support the vision then change it!", + "title": "Your personal professional web presence" + } + } # Simulate processing response_data = { - "products_data": product_data, - "member_id": 0, - "uid": 0, + "myproduct": myproduct_data, + "member_id": 1, + "uid": uid, } return ResponseHelper.success(data=response_data)