[fix]: Loan id
This commit was merged in pull request #5.
This commit is contained in:
+6
-3
@@ -7,7 +7,11 @@ from app.models.account import Account
|
||||
class Loan(db.Model):
|
||||
__tablename__ = 'loans'
|
||||
|
||||
id = db.Column(db.String(50), primary_key=True)
|
||||
id = db.Column(
|
||||
db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
)
|
||||
customer_id = db.Column(db.String(50), nullable=False)
|
||||
account_id = db.Column(db.String(50), nullable=False)
|
||||
offer_id = db.Column(db.String(20), nullable=False)
|
||||
@@ -18,7 +22,7 @@ class Loan(db.Model):
|
||||
|
||||
|
||||
@classmethod
|
||||
def create_loan(cls, id, customer_id, account_id, offer_id, principal_amount, status='pending'):
|
||||
def create_loan(cls, customer_id, account_id, offer_id, principal_amount, status='pending'):
|
||||
|
||||
# Check if customer exists
|
||||
is_valid = Customer.is_valid_customer(customer_id)
|
||||
@@ -33,7 +37,6 @@ class Loan(db.Model):
|
||||
|
||||
# Create and save the loan
|
||||
loan = cls(
|
||||
id=id,
|
||||
customer_id=customer_id,
|
||||
account_id=account_id,
|
||||
offer_id=offer_id,
|
||||
|
||||
Reference in New Issue
Block a user