2024-02-01 07:08:40 +00:00
|
|
|
package models
|
|
|
|
|
2024-02-07 15:40:43 +00:00
|
|
|
import (
|
|
|
|
"gorm.io/datatypes"
|
|
|
|
"time"
|
|
|
|
)
|
2024-02-01 07:08:40 +00:00
|
|
|
|
|
|
|
type Notification struct {
|
|
|
|
BaseModel
|
|
|
|
|
2024-02-07 15:40:43 +00:00
|
|
|
Subject string `json:"subject"`
|
|
|
|
Content string `json:"content"`
|
|
|
|
Links datatypes.JSONSlice[NotificationLink] `json:"links"`
|
|
|
|
IsImportant bool `json:"is_important"`
|
2024-03-31 08:03:59 +00:00
|
|
|
IsRealtime bool `json:"is_realtime" gorm:"-"`
|
2024-02-07 15:40:43 +00:00
|
|
|
ReadAt *time.Time `json:"read_at"`
|
|
|
|
SenderID *uint `json:"sender_id"`
|
|
|
|
RecipientID uint `json:"recipient_id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotificationLink Used to embed into notify and render actions
|
|
|
|
type NotificationLink struct {
|
|
|
|
Label string `json:"label"`
|
|
|
|
Url string `json:"url"`
|
2024-02-01 07:08:40 +00:00
|
|
|
}
|
2024-02-07 15:15:16 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
NotifySubscriberFirebase = "firebase"
|
|
|
|
)
|
|
|
|
|
|
|
|
type NotificationSubscriber struct {
|
|
|
|
BaseModel
|
|
|
|
|
|
|
|
UserAgent string `json:"user_agent"`
|
|
|
|
Provider string `json:"provider"`
|
2024-02-08 03:08:29 +00:00
|
|
|
DeviceID string `json:"device_id" gorm:"uniqueIndex"`
|
2024-02-07 15:15:16 +00:00
|
|
|
AccountID uint `json:"account_id"`
|
|
|
|
}
|