Skip to content

feat:alarm cronjob #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
typo
CommanderStorm committed Feb 7, 2024
commit 9270fa0331c3c09637371d2d8f7579e75d5ef05d
6 changes: 3 additions & 3 deletions server/backend/cron/alarm.go
Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@ func (c *CronService) alarmCron() error {
return notifyAllUsers(c.db, sendGCMNotification)
}

func sendGCMNotification(*[]model.Device) error {
func sendGCMNotification(*[]model.Devices) error {
log.Trace("sendGCMNotification")
return nil
}

func notifyAllUsers(db *gorm.DB, callbacks ...func(*[]model.Device) error) error {
func notifyAllUsers(db *gorm.DB, callbacks ...func(*[]model.Devices) error) error {
var pendingNotifications []model.Notification
if err := db.
Joins("notification_confirmation").
@@ -27,7 +27,7 @@ func notifyAllUsers(db *gorm.DB, callbacks ...func(*[]model.Device) error) error
}
for _, pending := range pendingNotifications {
// Get a few targets
var targets []model.Device
var targets []model.Devices
if err := db.
Distinct("device").
Where("notification = ?", pending.Notification).