This commit is contained in:
2026-01-25 21:59:00 +08:00
parent 7fd537bef3
commit 4cad3f0250
118 changed files with 30473 additions and 0 deletions

27
internal/models/ledger.go Normal file
View File

@@ -0,0 +1,27 @@
package models
// Ledger represents an independent accounting book for separating different accounting scenarios
// Feature: accounting-feature-upgrade
// Validates: Requirements 3.1
type Ledger struct {
BaseModel
UserID uint `gorm:"not null;index" json:"user_id"`
Name string `gorm:"size:100;not null" json:"name"`
Theme string `gorm:"size:50" json:"theme"` // pink, beige, brown
CoverImage string `gorm:"size:255" json:"cover_image"`
IsDefault bool `gorm:"default:false" json:"is_default"`
SortOrder int `gorm:"default:0" json:"sort_order"`
// Relationships
Transactions []Transaction `gorm:"foreignKey:LedgerID" json:"-"`
}
// TableName specifies the table name for Ledger
func (Ledger) TableName() string {
return "ledgers"
}
// MaxLedgersPerUser is the maximum number of ledgers a user can create
// Feature: accounting-feature-upgrade
// Validates: Requirements 3.12
const MaxLedgersPerUser = 10