[feat]: add models bind to eco database
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from app.eco.enums.installment_status import InstallmentStatus
|
||||
from sqlalchemy import Column, String, Date, Numeric, ForeignKey, Enum, Integer, DateTime
|
||||
from app.extensions import db
|
||||
import enum
|
||||
|
||||
class Installment(db.Model):
|
||||
__tablename__ = 'installments'
|
||||
__bind_key__ = 'eco'
|
||||
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
loan_id = Column(Integer, nullable=False)
|
||||
installment_number = Column(Integer, nullable=False)
|
||||
due_date = Column(Date, nullable=False)
|
||||
amount = Column(Numeric(12, 2), nullable=False)
|
||||
paid_amount = Column(Numeric(12, 2), default=0.00)
|
||||
status = Column(Enum(InstallmentStatus), default=InstallmentStatus.PENDING)
|
||||
penalty_amount = Column(Numeric(12, 2), default=0.00)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Installment(id={self.id}, loan_id={self.loan_id}, status={self.status})>"
|
||||
Reference in New Issue
Block a user