This commit is contained in:
2026-01-28 08:10:10 +08:00
10 changed files with 867 additions and 138 deletions

View File

@@ -835,6 +835,35 @@ func (AllocationRecordDetail) TableName() string {
return "allocation_record_details"
}
// NotificationType represents the type of notification
type NotificationType string
const (
NotificationTypeBudgetAlert NotificationType = "budget_alert" // 预算超支提醒
NotificationTypeRecurring NotificationType = "recurring" // 周期交易提醒
NotificationTypeSystem NotificationType = "system" // 系统公告
NotificationTypePaymentReminder NotificationType = "payment_reminder" // 还款提醒
NotificationTypeSavingsGoal NotificationType = "savings_goal" // 储蓄目标提醒
)
// Notification represents a user notification
// Feature: notification-center
type Notification struct {
ID uint `gorm:"primarykey" json:"id"`
UserID uint `gorm:"not null;index" json:"user_id"`
Type NotificationType `gorm:"size:30;not null;index" json:"type"`
Title string `gorm:"size:200;not null" json:"title"`
Content string `gorm:"size:1000;not null" json:"content"`
IsRead bool `gorm:"default:false;index" json:"is_read"`
RelatedID *uint `gorm:"index" json:"related_id,omitempty"` // 关联实体 ID (如预算、周期交易等)
CreatedAt time.Time `json:"created_at"`
}
// TableName specifies the table name for Notification
func (Notification) TableName() string {
return "notifications"
}
// AllModels returns all models for database migration
func AllModels() []interface{} {
return []interface{}{
@@ -865,6 +894,7 @@ func AllModels() []interface{} {
&SystemCategory{}, // Feature: accounting-feature-upgrade
&TransactionImage{}, // Feature: accounting-feature-upgrade
&UserSettings{}, // Feature: accounting-feature-upgrade
&Notification{}, // Feature: notification-center
}
}