23 lines
932 B
Go
23 lines
932 B
Go
package entity
|
|
|
|
import (
|
|
"backend/pkg/notification/domain/notification"
|
|
"time"
|
|
|
|
"github.com/gocql/gocql"
|
|
)
|
|
|
|
// UserNotification represents a notification for a specific user.
|
|
type UserNotification struct {
|
|
UserID string `db:"user_id" partition_key:"true"` // 收通知的人
|
|
Bucket string `db:"bucket" partition_key:"true"` // 分桶,例如 '2025-11' 或 '2025-11-17'
|
|
TS gocql.UUID `db:"ts" clustering_key:"true"` // 通知時間,用 now() 產生,排序用(UTC0)
|
|
EventID gocql.UUID `db:"event_id"` // 對應 notification_event.event_id
|
|
Status notification.NotifyStatus `db:"status"` // UNREAD / READ / ARCHIVED
|
|
ReadAt time.Time `db:"read_at"` // 已讀時間(非必填)
|
|
}
|
|
|
|
func (un *UserNotification) TableName() string {
|
|
return "user_notification"
|
|
}
|