package model import "time" // Notification 是站内通知的 PostgreSQL 持久化事实。 type Notification struct { ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` EventID string `gorm:"column:event_id;type:varchar(64);not null;uniqueIndex:uq_notification_event_recipient,priority:1" json:"event_id"` RecipientKind string `gorm:"column:recipient_kind;type:varchar(32);not null;uniqueIndex:uq_notification_event_recipient,priority:2" json:"recipient_kind"` RecipientID uint `gorm:"column:recipient_id;not null;uniqueIndex:uq_notification_event_recipient,priority:3" json:"recipient_id"` Category string `gorm:"column:category;type:varchar(32);not null" json:"category"` Type string `gorm:"column:type;type:varchar(100);not null" json:"type"` Severity string `gorm:"column:severity;type:varchar(16);not null" json:"severity"` Title string `gorm:"column:title;type:varchar(200);not null" json:"title"` Body string `gorm:"column:body;type:text;not null" json:"body"` RefType string `gorm:"column:ref_type;type:varchar(64);not null;default:''" json:"ref_type"` RefID string `gorm:"column:ref_id;type:varchar(128);not null;default:''" json:"ref_id"` RefKey string `gorm:"column:ref_key;type:varchar(128);not null;default:''" json:"ref_key"` IsRead bool `gorm:"column:is_read;not null;default:false" json:"is_read"` ReadAt *time.Time `gorm:"column:read_at;type:timestamptz" json:"read_at,omitempty"` ExpiresAt *time.Time `gorm:"column:expires_at;type:timestamptz" json:"expires_at,omitempty"` CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null;autoCreateTime" json:"created_at"` } // TableName 返回站内通知表名。 func (Notification) TableName() string { return "tb_notification" }