contacts commoents list
This commit is contained in:
@@ -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({
|
||||
|
||||
+14
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user