From cb6f7397b6a893e747994fadee3b4453d6056eef Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 5 Jul 2025 15:35:00 -0400 Subject: [PATCH] fix data --- app/api/services/account.py | 2 ++ app/api/services/myproduct.py | 30 +++++++++++++++++++++++++++++- app/models/products.py | 9 +++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/api/services/account.py b/app/api/services/account.py index 56df6de..bfb9b9b 100644 --- a/app/api/services/account.py +++ b/app/api/services/account.py @@ -50,6 +50,7 @@ class AccountService(BaseService): member_actions = MembersActions.get_recent_member_actions(1) member_actions_data = [] + product_data =[] for t in member_actions: product_data.append({ @@ -115,6 +116,7 @@ class AccountService(BaseService): "account_name": member.account_name, "firstname":member.firstname, "lastname": member.lastname, + "email": member.email, "room": member.uid, "token": user_token } diff --git a/app/api/services/myproduct.py b/app/api/services/myproduct.py index 8294903..cf8d909 100644 --- a/app/api/services/myproduct.py +++ b/app/api/services/myproduct.py @@ -34,9 +34,37 @@ class MyProductsService(BaseService): uid = validated_data.get('uid') product_id = validated_data.get('product_id') + ''' + Table "public.products" + Column | Type | Collation | Nullable | Default + -------------+-----------------------------+-----------+----------+-------------------------------------- + id | integer | | not null | nextval('products_id_seq'::regclass) + uid | uuid | | | uuid_generate_v4() + product_id | character varying(25) | | not null | + name | character varying(100) | | not null | + description | character varying(250) | | not null | + status | integer | | | 0 + added | timestamp without time zone | | | now() + updated | timestamp without time zone | | | now() + banner | character varying(100) | | | + Indexes: + "products_id_key" UNIQUE CONSTRAINT, btree (id) + "products_name_key" UNIQUE CONSTRAINT, btree (name) + "products_product_id_key" UNIQUE CONSTRAINT, btree (product_id) + Referenced by: + TABLE "members_products" CONSTRAINT "members_products_product_id_fkey" FOREIGN KEY (product_id) REFERENCES products(product_id) + + + merms_panel=# + + + ''' + product_data = Products.get_product_by_product_id(product_id) + + # "banner": "banner.jpg", myproduct_data = { "myproudct": { - "banner": "banner.jpg", + "banner": product_data['banner'], "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", diff --git a/app/models/products.py b/app/models/products.py index 98f2e28..0d4983b 100644 --- a/app/models/products.py +++ b/app/models/products.py @@ -64,6 +64,15 @@ class Products(db.Model): raise ValueError(f"No available Products") return product_list + @classmethod + def get_product_by_product_id(cls, product_id): + """ + Get customer's active loans by loan_id. + """ + productItem = cls.query.filter_by(product_id = product_id).first() + if not productItem: + raise ValueError(f"pProduct with ID {product_id} does not exist.") + return productItem def to_dict(self): """