aboutsummaryrefslogtreecommitdiffstats
path: root/backend/internal/models
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswa Kalyan Bhuyan <biswa@surgot.in> 2025-04-28 08:32:07 +0530
committerLibravatarLibravatar Biswa Kalyan Bhuyan <biswa@surgot.in> 2025-04-28 08:32:07 +0530
commitd2c03d9417fb289d455f80f4c6facd7274c31d3e (patch)
tree3de135eb932ff20aa50abfb39d5a8abba4758d65 /backend/internal/models
parent538d933baef56d7ee76f78617b553d63713efa24 (diff)
downloadfinance-d2c03d9417fb289d455f80f4c6facd7274c31d3e.tar.gz
finance-d2c03d9417fb289d455f80f4c6facd7274c31d3e.tar.bz2
finance-d2c03d9417fb289d455f80f4c6facd7274c31d3e.zip
finance/backend: feat: Refined APIs for Loans and Goals based on frontend needsHEADmaster
Diffstat (limited to 'backend/internal/models')
-rw-r--r--backend/internal/models/models.go18
1 files changed, 17 insertions, 1 deletions
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