Added files
This commit is contained in:
parent
e9ce21133a
commit
c2555a1d35
26
notification/ntfy.go
Normal file
26
notification/ntfy.go
Normal 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
5
notification/pkg.go
Normal file
@ -0,0 +1,5 @@
|
||||
package notification
|
||||
|
||||
type Notification interface {
|
||||
Send([]byte) error
|
||||
}
|
@ -126,6 +126,7 @@ func RetrieveSchedules(userID int, nodeID int) (schedules []Schedule, err error)
|
||||
|
||||
func ExpiredSchedules() []Schedule {
|
||||
schedules := []Schedule{}
|
||||
/*
|
||||
res, err := service.Db.Conn.Query(`
|
||||
SELECT
|
||||
*
|
||||
@ -136,5 +137,6 @@ func ExpiredSchedules() []Schedule {
|
||||
ORDER BY
|
||||
time ASC
|
||||
`)
|
||||
*/
|
||||
return schedules
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user