From ea06665f6dc4d71561cce689184cd0ebfa758925 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 7 Oct 2025 08:03:12 -0400 Subject: [PATCH] contacts commoents list --- app/api/services/comments.py | 2 +- app/models/products.py | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/api/services/comments.py b/app/api/services/comments.py index 95beccf..d5503ba 100644 --- a/app/api/services/comments.py +++ b/app/api/services/comments.py @@ -35,7 +35,7 @@ class CommentsService(BaseService): member_data = Members.get_member_by_uid(uid) member_id = member_data.id - contacts_product_list = Products.get_contact_supported_product_list(member_id) + contacts_product_list = Products.get_comments_supported_product_list(member_id) category_data = [] for t in contacts_product_list: category_data.append({ diff --git a/app/models/products.py b/app/models/products.py index 134bf08..1299cb6 100644 --- a/app/models/products.py +++ b/app/models/products.py @@ -32,7 +32,9 @@ class Products(db.Model): added = db.Column(db.DateTime(timezone=True), server_default=func.now()) updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) banner = db.Column(db.String(100), nullable=True) - + list_order = db.Column(db.Integer, nullable=True, default=0) + contacts = db.Column(db.Integer, nullable=True, default=0) + comments = db.Column(db.Integer, nullable=True, default=0) members_products = relationship( "MembersProducts", @@ -71,15 +73,17 @@ class Products(db.Model): @classmethod def get_contact_supported_product_list(cls, member_id): - """ - Return all offers in dictionary format. - """ - product_list = cls.query.all() - + product_list = cls.query.filter_by(contacts=1).all() if not product_list: - raise ValueError(f"No available Products") + return None return product_list + @classmethod + def get_comments_supported_product_list(cls, member_id): + product_list = cls.query.filter_by(comments=1).all() + if not product_list: + return None + return product_list @classmethod def get_user_product_list(cls, member_id): @@ -116,6 +120,9 @@ class Products(db.Model): 'description' : self.description, 'start_url': self.start_url, 'status': self.status, + 'list_order': self.list_order, + 'contacts': self.contacts, + 'comments': self.comments, 'added': self.added, 'updated': self.updated, 'banner': self.banner