feat: add finance module with yearly income/expense tracking
- FinanceEntry model (income/expense x fixed/extra) - CRUD API endpoints for finance entries - FinancePage with summary cards and drill-down - Updated navigation with Finance tab - Updated todos default filter to active
This commit is contained in:
@@ -31,3 +31,22 @@ type DailyLog struct {
|
||||
func (DailyLog) TableName() string {
|
||||
return "daily_logs"
|
||||
}
|
||||
|
||||
// FinanceEntry 收支条目
|
||||
// Type: income(收入) / expense(支出)
|
||||
// Category: fixed(固定) / extra(额外)
|
||||
type FinanceEntry struct {
|
||||
ID uint64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||
Year int `gorm:"type:int;not null;index" json:"year"` // 年份
|
||||
Month int `gorm:"type:int;not null;default:0" json:"month"` // 月份(0表示全年)
|
||||
Type string `gorm:"type:varchar(10);not null" json:"type"` // income / expense
|
||||
Category string `gorm:"type:varchar(10);not null" json:"category"` // fixed / extra
|
||||
Description string `gorm:"type:varchar(255)" json:"description"` // 条目描述
|
||||
Amount float64 `gorm:"type:decimal(12,2);not null" json:"amount"` // 金额(正数)
|
||||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (FinanceEntry) TableName() string {
|
||||
return "finance_entries"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user