diff --git a/notification/ntfy.go b/notification/ntfy.go new file mode 100644 index 0000000..d6fd2f2 --- /dev/null +++ b/notification/ntfy.go @@ -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 +} diff --git a/notification/pkg.go b/notification/pkg.go new file mode 100644 index 0000000..194d88a --- /dev/null +++ b/notification/pkg.go @@ -0,0 +1,5 @@ +package notification + +type Notification interface { + Send([]byte) error +} diff --git a/schedule.go b/schedule.go index d2c7aec..cfb0406 100644 --- a/schedule.go +++ b/schedule.go @@ -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 }