28 lines
940 B
Go
28 lines
940 B
Go
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
|