add loan and loan_charges model

This commit is contained in:
2025-04-17 14:40:46 +01:00
parent 4abafa9a6c
commit 0268bbd557
3 changed files with 115 additions and 0 deletions
+13
View File
@@ -20,6 +20,19 @@ class Transaction(db.Model):
def __repr__(self):
return f'<Transaction {self.id}>'
def to_dict(self):
"""
Convert the Transaction object to a dictionary format for JSON serialization.
"""
return {
'id': self.id,
'transaction_id': self.transaction_id,
'account_id': self.account_id,
'customer_id': self.customer_id,
'type': self.type,
'channel': self.channel,
}
@classmethod
def get_transaction_by_transaction_id(cls, transaction_id):
return cls.query.filter_by(transaction_id=transaction_id).first()