added repayment_schedule
This commit is contained in:
@@ -55,8 +55,28 @@ class LoanRepaymentSchedule(db.Model):
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching repayment schedule for loan_id={loan_id}: {e}")
|
||||
return []
|
||||
@classmethod
|
||||
def get_repayment_schedule_by_id_and_transaction_id(cls, id, transaction_id):
|
||||
"""
|
||||
Get repayment schedule by ID and transaction ID
|
||||
"""
|
||||
try:
|
||||
return cls.query.filter_by(id=id, transaction_id=transaction_id).first()
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching repayment schedule for id={id}, transaction_id={transaction_id}: {e}")
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def get_overdue_repayment_schedule(cls):
|
||||
"""
|
||||
Get all overdue repayment schedules.
|
||||
"""
|
||||
try:
|
||||
return cls.query.filter(cls.due_date < datetime.now(timezone.utc), cls.paid == False).all()
|
||||
except Exception as e:
|
||||
logger.error(f"Error fetching overdue repayment schedules: {e}")
|
||||
return []
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_repayment_schedule_by_transaction_id(cls, transaction_id):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user