Fix default topics

This commit is contained in:
CHIEFSOFT\ameye
2025-06-02 12:08:19 -04:00
parent 9fc3104c79
commit 4619f83d46
3 changed files with 19 additions and 7 deletions
+10 -6
View File
@@ -6,6 +6,7 @@ from datetime import timedelta
import logging
from sqlalchemy import and_, or_, not_
from sqlalchemy.sql import func
from app.utils.logger import logger
class Loan(db.Model):
__tablename__ = "loans"
@@ -62,6 +63,7 @@ class Loan(db.Model):
"""
return {
'debtId': self.id,
"customerId": self.customer_id,
'initialLoanAmount': self.initial_loan_amount,
'currentLoanAmount': self.current_loan_amount,
'defaultPenaltyFee': self.default_penalty_fee,
@@ -70,7 +72,10 @@ class Loan(db.Model):
'status': self.status,
'productId': self.product_id,
'dueDate': self.due_date.isoformat() if self.due_date else None,
'loanDate': self.created_at.isoformat if self.created_at else None
'loanDate': self.created_at.isoformat if self.created_at else None,
'disburseDate': self.disburse_date.isoformat() if self.disburse_date else None,
'disburseVerify': self.disburse_verify.isoformat if self.disburse_verify else None,
'reference': self.reference
}
@classmethod
@@ -91,9 +96,8 @@ class Loan(db.Model):
if not loan:
raise ValueError(f"Loan with ID {loan_id} does not exist.")
if loan.status == status:
return
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
logger.info(f"What is now ======= ==== ==> : {current_time}")
# Update loan disburse_date and timestamp datetime.today().strftime('%Y-%m-%d %H:%M:%S')
loan.disburse_date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
loan.disburse_date = current_time # datetime.today().strftime('%Y-%m-%d %H:%M:%S')