[update]: Loan status
This commit is contained in:
@@ -99,6 +99,20 @@ class Loan(db.Model):
|
||||
# Update loan status and the updated_at timestamp
|
||||
loan.status = status
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Convert the Loan object to a dictionary format for JSON serialization.
|
||||
"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'customer_id': self.customer_id,
|
||||
'account_id': self.account_id,
|
||||
'offer_id': self.offer_id,
|
||||
'principal_amount': self.principal_amount,
|
||||
'status': self.status,
|
||||
'created_at': self.created_at.isoformat() if self.created_at else None,
|
||||
'updated_at': self.updated_at.isoformat() if self.updated_at else None
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Loan {self.id}>'
|
||||
Reference in New Issue
Block a user