Files

22 lines
966 B
Go
Raw Permalink Normal View History

// Package notification 存放 notifications 表的实体定义。
// worker 与 video 都依赖它,因此列标签只有一处。
package notification
import "time"
type Notification struct {
ID uint `gorm:"primaryKey" json:"id"`
RecipientID uint `gorm:"index;not null" json:"recipient_id"`
SenderID uint `gorm:"not null" json:"sender_id"`
Type string `gorm:"type:varchar(50);not null" json:"type"`
TargetID uint `gorm:"column:target_id" json:"target_id"`
Content string `gorm:"type:varchar(255)" json:"content"`
IsRead bool `gorm:"default:false" json:"is_read"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
// DedupeKey 用 *string:无意图键的通知写 NULL,不参与唯一约束。
DedupeKey *string `gorm:"column:dedupe_key;type:varchar(128);uniqueIndex:uk_notifications_dedupe" json:"-"`
}
func (Notification) TableName() string { return "notifications" }