✨ Subscribable notification
This commit is contained in:
@@ -5,6 +5,19 @@ import (
|
||||
"code.smartsheep.studio/hydrogen/passport/pkg/models"
|
||||
)
|
||||
|
||||
func AddNotifySubscriber(user models.Account, provider, device, ua string) (models.NotificationSubscriber, error) {
|
||||
subscriber := models.NotificationSubscriber{
|
||||
UserAgent: ua,
|
||||
Provider: provider,
|
||||
DeviceID: ua,
|
||||
AccountID: user.ID,
|
||||
}
|
||||
|
||||
err := database.C.Save(&subscriber).Error
|
||||
|
||||
return subscriber, err
|
||||
}
|
||||
|
||||
func NewNotification(user models.ThirdClient, target models.Account, subject, content string, important bool) error {
|
||||
notification := models.Notification{
|
||||
Subject: subject,
|
||||
|
Reference in New Issue
Block a user