add loan and loan_charges model
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user