product list

This commit is contained in:
CHIEFSOFT\ameye
2025-07-05 16:59:17 -04:00
parent c0771483b3
commit ae69741a44
2 changed files with 12 additions and 2 deletions
+10
View File
@@ -32,6 +32,16 @@ class MembersProducts(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())
@classmethod
def get_member_productlist_by_member_id(cls, member_id):
member_products = cls.query.filter_by(member_id=str(member_id))
if not member_products:
raise ValueError(f"Products for member_id = {member_id} not found")
return member_products
def to_dict(self):
"""
Convert the Loan object to a dictionary format for JSON serialization.