27 lines
1.4 KiB
Go
27 lines
1.4 KiB
Go
package entity
|
||
|
||
import (
|
||
"backend/pkg/notification/domain/notification"
|
||
"time"
|
||
|
||
"github.com/gocql/gocql"
|
||
)
|
||
|
||
// NotificationEvent represents an event that triggers a notification.
|
||
type NotificationEvent struct {
|
||
EventID gocql.UUID `db:"event_id" partition_key:"true"` // 事件 ID
|
||
EventType string `db:"event_type"` // POST_PUBLISHED / COMMENT_ADDED / MENTIONED ...
|
||
ActorUID string `db:"actor_uid"` // 觸發者 UID
|
||
ObjectType string `db:"object_type"` // POST / COMMENT / USER ...
|
||
ObjectID string `db:"object_id"` // 對應物件 ID(post_id 等)
|
||
Title string `db:"title"` // 顯示用標題
|
||
Body string `db:"body"` // 顯示用內容 / 摘要
|
||
Payload string `db:"payload"` // JSON string(額外欄位,例如 {"postId": "..."})
|
||
Priority notification.NotifyPriority `db:"priority"` // 1=critical, 2=high, 3=normal, 4=low
|
||
CreatedAt time.Time `db:"created_at"` // 事件時間(方便做 cross table 查詢)
|
||
}
|
||
|
||
func (ue *NotificationEvent) TableName() string {
|
||
return "notification_event"
|
||
}
|