56 lines
2.2 KiB
Go
56 lines
2.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// UserSettings represents user preferences and settings
|
|
// Feature: accounting-feature-upgrade
|
|
// Validates: Requirements 5.4, 6.5, 8.25-8.27
|
|
type UserSettings struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
UserID *uint `gorm:"uniqueIndex" json:"user_id,omitempty"`
|
|
PreciseTimeEnabled bool `gorm:"default:true" json:"precise_time_enabled"`
|
|
IconLayout string `gorm:"size:10;default:'five'" json:"icon_layout"` // four, five, six
|
|
ImageCompression string `gorm:"size:10;default:'medium'" json:"image_compression"` // low, medium, high
|
|
ShowReimbursementBtn bool `gorm:"default:true" json:"show_reimbursement_btn"`
|
|
ShowRefundBtn bool `gorm:"default:true" json:"show_refund_btn"`
|
|
CurrentLedgerID *uint `gorm:"index" json:"current_ledger_id,omitempty"`
|
|
|
|
// Default account settings
|
|
// Feature: financial-core-upgrade
|
|
// Validates: Requirements 5.1, 5.2
|
|
DefaultExpenseAccountID *uint `gorm:"index" json:"default_expense_account_id,omitempty"`
|
|
DefaultIncomeAccountID *uint `gorm:"index" json:"default_income_account_id,omitempty"`
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
// Relationships
|
|
DefaultExpenseAccount *Account `gorm:"foreignKey:DefaultExpenseAccountID" json:"default_expense_account,omitempty"`
|
|
DefaultIncomeAccount *Account `gorm:"foreignKey:DefaultIncomeAccountID" json:"default_income_account,omitempty"`
|
|
}
|
|
|
|
// TableName specifies the table name for UserSettings
|
|
func (UserSettings) TableName() string {
|
|
return "user_settings"
|
|
}
|
|
|
|
// IconLayoutType represents the icon layout options
|
|
type IconLayoutType string
|
|
|
|
const (
|
|
IconLayoutFour IconLayoutType = "four"
|
|
IconLayoutFive IconLayoutType = "five"
|
|
IconLayoutSix IconLayoutType = "six"
|
|
)
|
|
|
|
// ImageCompressionType represents the image compression options
|
|
type ImageCompressionType string
|
|
|
|
const (
|
|
ImageCompressionLow ImageCompressionType = "low" // 鏍囨竻 - max width 800px
|
|
ImageCompressionMedium ImageCompressionType = "medium" // 楂樻竻 - max width 1200px
|
|
ImageCompressionHigh ImageCompressionType = "high" // 鍘熺敾 - no compression
|
|
)
|