aboutsummaryrefslogtreecommitdiffstats
path: root/backend/internal/models/models.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/internal/models/models.go')
-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