From ee87614f6effdcee3794e3053c374769613590db Mon Sep 17 00:00:00 2001 From: Chinenye Nmoh Date: Thu, 20 Nov 2025 14:18:47 +0100 Subject: [PATCH 1/2] added loan_repayment_schedule --- .example.env | 26 ---------------------- Dockerfile | 4 ++-- app/api/enums/__init__.py | 3 ++- app/api/enums/repayment_schedule_status.py | 6 +++++ app/models/loan_repayment_schedule.py | 2 ++ scripts/{entrypoint.sh => entry.sh} | 0 6 files changed, 12 insertions(+), 29 deletions(-) delete mode 100644 .example.env create mode 100644 app/api/enums/repayment_schedule_status.py rename scripts/{entrypoint.sh => entry.sh} (100%) mode change 100755 => 100644 diff --git a/.example.env b/.example.env deleted file mode 100644 index 47a154c..0000000 --- a/.example.env +++ /dev/null @@ -1,26 +0,0 @@ -VALID_APP_ID=********** -VALID_API_KEY=************* -BASIC_AUTH_USERNAME=****** -BASIC_AUTH_PASSWORD=****** - - -SWAGGER_URL="/documentation" -API_URL="/swagger.json" - -JWT_SECRET_KEY=****** -JWT_ACCESS_TOKEN_EXPIRES=****** -JWT_REFRESH_TOKEN_EXPIRES=****** - - -DATABASE_USER=***** -DATABASE_PASSWORD=***** -DATABASE_HOST=****** -DATABASE_PORT=****** -DATABASE_NAME=***** - -# Flask Configuration -FLASK_APP=wsgi.py -FLASK_ENV=development -APP_PORT=4500 - -SIMBRELLA_BASE_URL=*************** \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0bc8e59..c8d6546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,6 @@ EXPOSE 5000 ENV FLASK_APP=app.py ENV FLASK_RUN_HOST=0.0.0.0 -RUN chmod +x scripts/entrypoint.sh +RUN chmod +x scripts/entry.sh -ENTRYPOINT ["scripts/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["scripts/entry.sh"] \ No newline at end of file diff --git a/app/api/enums/__init__.py b/app/api/enums/__init__.py index deb3f94..dc4aff8 100644 --- a/app/api/enums/__init__.py +++ b/app/api/enums/__init__.py @@ -1,2 +1,3 @@ from .transaction_type import TransactionType -from .loan_status import LoanStatus \ No newline at end of file +from .loan_status import LoanStatus +from .repayment_schedule_status import RepaymentScheduleStatus \ No newline at end of file diff --git a/app/api/enums/repayment_schedule_status.py b/app/api/enums/repayment_schedule_status.py new file mode 100644 index 0000000..bde960d --- /dev/null +++ b/app/api/enums/repayment_schedule_status.py @@ -0,0 +1,6 @@ +from enum import Enum + +class RepaymentScheduleStatus(str, Enum): + ACTIVE = "active" + PARTIALLY_PAID = "partially_paid" + REPAID = "repaid" \ No newline at end of file diff --git a/app/models/loan_repayment_schedule.py b/app/models/loan_repayment_schedule.py index 899510c..10be427 100644 --- a/app/models/loan_repayment_schedule.py +++ b/app/models/loan_repayment_schedule.py @@ -3,6 +3,7 @@ from app.extensions import db from sqlalchemy.orm import relationship from dateutil.relativedelta import relativedelta from sqlalchemy.sql import func +from app.api.enums.repayment_schedule_status import RepaymentScheduleStatus class LoanRepaymentSchedule(db.Model): __tablename__ = 'loan_repayment_schedules' @@ -51,6 +52,7 @@ class LoanRepaymentSchedule(db.Model): installment_amount=round(loan.installment_amount, 2), product_id = loan.product_id, transaction_id = transaction_id, + paid_status = RepaymentScheduleStatus.ACTIVE, created_at=datetime.now(timezone.utc), updated_at=datetime.now(timezone.utc) ) diff --git a/scripts/entrypoint.sh b/scripts/entry.sh old mode 100755 new mode 100644 similarity index 100% rename from scripts/entrypoint.sh rename to scripts/entry.sh -- 2.34.1 From 4070dbadf792650ea932ca9f6d600a96097845d3 Mon Sep 17 00:00:00 2001 From: Chinenye Nmoh Date: Thu, 20 Nov 2025 14:24:47 +0100 Subject: [PATCH 2/2] added loan_repayment_schedule --- app/models/loan_repayment_schedule.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/loan_repayment_schedule.py b/app/models/loan_repayment_schedule.py index 10be427..5463e2f 100644 --- a/app/models/loan_repayment_schedule.py +++ b/app/models/loan_repayment_schedule.py @@ -70,6 +70,7 @@ class LoanRepaymentSchedule(db.Model): 'dueDate': self.due_date.isoformat(), 'principalAmount': self.principal_amount, 'interestAmount': self.interest_amount, + 'paid_status': self.paid_status, 'totalInstallment': self.total_installment, 'paid': self.paid, 'paidAt': self.paid_at.isoformat() if self.paid_at else None -- 2.34.1