[fix]: loan amount

This commit is contained in:
VivianDee
2025-04-25 15:33:58 +01:00
parent ddbabcaca9
commit 851422c335
2 changed files with 9 additions and 10 deletions
+5 -8
View File
@@ -4,10 +4,7 @@ from app.models.customer import Customer
from app.models.account import Account
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import relationship
from app.models.loan_charge import LoanCharge
from dateutil.relativedelta import relativedelta
from app.models.loan_repayment_schedule import LoanRepaymentSchedule # Make sure this import exists
from dateutil.relativedelta import relativedelta
class Loan(db.Model):
@@ -45,18 +42,19 @@ class Loan(db.Model):
loan_charges = relationship(
"LoanCharge",
primaryjoin="Loan.id == LoanCharge.loan_id",
primaryjoin="LoanCharge.loan_id == Loan.id",
foreign_keys="LoanCharge.loan_id",
back_populates="loan",
)
loan_repayent_schedules = relationship(
loan_repayment_schedules = relationship(
"LoanRepaymentSchedule",
primaryjoin="Loan.id == LoanRepaymentSchedule.loan_id",
primaryjoin="LoanRepaymentSchedule.loan_id == Loan.id",
foreign_keys="LoanRepaymentSchedule.loan_id",
back_populates="loan",
)
@classmethod
def create_loan(
cls,
@@ -70,7 +68,6 @@ class Loan(db.Model):
upfront_fee,
repayment_amount,
installment_amount,
tenor,
status="pending",
):
# Check if customer exists