Office back fix
This commit is contained in:
@@ -76,6 +76,30 @@ class MembersWebfiles(db.Model):
|
||||
return None
|
||||
return member_webfile
|
||||
|
||||
@classmethod
|
||||
def get_all_webfiles(cls, file_group=None, member_id=None, page=1, limit=20):
|
||||
|
||||
query = cls.query
|
||||
logger.info(f"Get all payments back")
|
||||
|
||||
if member_id:
|
||||
query = query.filter(cls.member_id == member_id)
|
||||
|
||||
if file_group:
|
||||
query = query.filter(cls.file_group == file_group)
|
||||
|
||||
# Order by created_at descending (newest first)
|
||||
query = query.order_by(cls.added.desc())
|
||||
|
||||
# Get total count before pagination
|
||||
total_count = query.count()
|
||||
|
||||
# Apply pagination
|
||||
offset = (page - 1) * limit
|
||||
query = query.limit(limit).offset(offset)
|
||||
|
||||
return query.all(), total_count
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Convert the Loan object to a dictionary format for JSON serialization.
|
||||
|
||||
Reference in New Issue
Block a user