done with check transaction_id on repayment
This commit was merged in pull request #14.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from .transactions import Transaction
|
||||
from .repayment import Repayment
|
||||
|
||||
__all__ = ['Transaction']
|
||||
__all__ = ['Transaction', 'Repayment']
|
||||
@@ -0,0 +1,24 @@
|
||||
from app.extensions import db
|
||||
from datetime import datetime, timezone
|
||||
|
||||
class Repayment(db.Model):
|
||||
__tablename__ = "repayments"
|
||||
|
||||
id = db.Column(
|
||||
db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
)
|
||||
loan_id = db.Column(db.String(50), nullable=False)
|
||||
customer_id = db.Column(db.String(50), nullable=False)
|
||||
product_id = db.Column(db.String(20), nullable=True)
|
||||
transaction_id = db.Column(db.String(50), nullable=False)
|
||||
created_at = db.Column(db.DateTime, default=datetime.now(timezone.utc))
|
||||
updated_at = db.Column(db.DateTime, default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc))
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Repayment {self.id}>'
|
||||
|
||||
@classmethod
|
||||
def get_repayment_by_transaction_id(cls, transaction_id):
|
||||
return cls.query.filter_by(transaction_id=transaction_id).first()
|
||||
Reference in New Issue
Block a user