Added temperature exceded event

This commit is contained in:
Nedim
2023-10-16 19:43:35 +02:00
parent 44efa194fc
commit 2e60460131
7 changed files with 109 additions and 70 deletions

View File

@@ -1,4 +1,4 @@
package notification
package messaging
import (
"fmt"
@@ -12,9 +12,12 @@ type service struct {
db *gorm.DB
}
var MessagingChannel chan models.Notification
func NewService(ch chan models.Notification, db *gorm.DB) service {
MessagingChannel = ch
return service{
ch: ch,
ch: MessagingChannel,
db: db,
}
}
@@ -28,4 +31,8 @@ func (s service) MessagingService() {
fmt.Printf("Error saving notification to DB: %v\n", err)
}
}
}
func GetMessagingChannel() chan models.Notification {
return MessagingChannel
}