Added files

This commit is contained in:
Magnus Åhall 2024-03-29 08:06:23 +01:00
parent e9ce21133a
commit c2555a1d35
3 changed files with 33 additions and 0 deletions

26
notification/ntfy.go Normal file
View File

@ -0,0 +1,26 @@
package notification
import (
// Standard
"bytes"
"encoding/json"
"net/http"
)
type NTFY struct {
URL string
}
func NewNTFY(config []byte) (instance NTFY, err error) {
err = json.Unmarshal(config, &instance)
if err != nil {
return
}
return instance, nil
}
func (ntfy NTFY) Send(msg []byte) (err error) {
http.NewRequest("POST", ntfy.URL, bytes.NewReader(msg))
return
}

5
notification/pkg.go Normal file
View File

@ -0,0 +1,5 @@
package notification
type Notification interface {
Send([]byte) error
}

View File

@ -126,6 +126,7 @@ func RetrieveSchedules(userID int, nodeID int) (schedules []Schedule, err error)
func ExpiredSchedules() []Schedule { func ExpiredSchedules() []Schedule {
schedules := []Schedule{} schedules := []Schedule{}
/*
res, err := service.Db.Conn.Query(` res, err := service.Db.Conn.Query(`
SELECT SELECT
* *
@ -136,5 +137,6 @@ func ExpiredSchedules() []Schedule {
ORDER BY ORDER BY
time ASC time ASC
`) `)
*/
return schedules return schedules
} }