This commit is contained in:
CHIEFSOFT\ameye
2025-07-04 10:29:32 -04:00
parent 7778b3ce20
commit 19afb52c53
2 changed files with 29 additions and 38 deletions
+7
View File
@@ -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)
+22 -38
View File
@@ -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)