Passport/pkg/internal/models/notifications.go

41 lines
1.2 KiB
Go
Raw Normal View History

2024-02-01 07:08:40 +00:00
package models
import (
2024-06-02 12:15:04 +00:00
"gorm.io/datatypes"
)
2024-02-01 07:08:40 +00:00
type Notification struct {
BaseModel
2024-06-02 12:15:04 +00:00
Type string `json:"type"`
Subject string `json:"subject"`
Content string `json:"content"`
2024-06-02 12:15:04 +00:00
Metadata datatypes.JSONMap `json:"metadata"`
Links datatypes.JSONSlice[NotificationLink] `json:"links"`
2024-03-31 08:03:59 +00:00
IsRealtime bool `json:"is_realtime" gorm:"-"`
2024-06-07 12:05:56 +00:00
IsForcePush bool `json:"is_force_push" gorm:"-"`
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 (
2024-06-06 14:48:43 +00:00
NotifySubscriberFirebase = "firebase"
NotifySubscriberAPNs = "apple"
2024-02-07 15:15:16 +00:00
)
type NotificationSubscriber struct {
BaseModel
UserAgent string `json:"user_agent"`
Provider string `json:"provider"`
DeviceID string `json:"device_id" gorm:"uniqueIndex"`
DeviceToken string `json:"device_token"`
AccountID uint `json:"account_id"`
2024-02-07 15:15:16 +00:00
}