From d2c03d9417fb289d455f80f4c6facd7274c31d3e Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Mon, 28 Apr 2025 08:32:07 +0530 Subject: finance/backend: feat: Refined APIs for Loans and Goals based on frontend needs --- backend/internal/models/models.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'backend/internal/models') diff --git a/backend/internal/models/models.go b/backend/internal/models/models.go index c984012..3d409a6 100644 --- a/backend/internal/models/models.go +++ b/backend/internal/models/models.go @@ -94,4 +94,20 @@ type Goal struct { // RelatedLoanID *uint } -// Add other models below (Goal) +// LoanPayment tracks payments made towards a loan +type LoanPayment struct { + gorm.Model + UserID uint `gorm:"not null;index"` // Foreign key to User + User User // Belongs To relationship + LoanID uint `gorm:"not null;index"` // Foreign key to Loan + Loan Loan // Belongs To relationship + Amount int64 `gorm:"not null"` // In smallest currency unit + PaymentDate time.Time `gorm:"not null;index"` // Date payment was made + TransactionID *uint `gorm:"index"` // Optional link to transaction + Transaction *Transaction // Belongs To relationship + Principal int64 // Portion of payment going to principal + Interest int64 // Portion of payment going to interest + Notes string // Any payment notes +} + +// Add other models below -- cgit v1.2.3-59-g8ed1b