diff --git a/backend/pkg/main.go b/backend/pkg/main.go index 5226835..7e11c00 100644 --- a/backend/pkg/main.go +++ b/backend/pkg/main.go @@ -22,8 +22,6 @@ func main() { serveOptions, sqliteDatasource := getServeOptions() - createReports() - c := cron.New() c.AddFunc("@every 30s", getScheduler(sqliteDatasource)) c.Start() diff --git a/backend/pkg/scheduler.go b/backend/pkg/scheduler.go index 74283a8..3933d78 100644 --- a/backend/pkg/scheduler.go +++ b/backend/pkg/scheduler.go @@ -13,15 +13,6 @@ type EmailConfig struct { password string } -type SmtpServer struct { - host string - port string -} - -func (smtpServer *SmtpServer) Address() string { - return smtpServer.host + ":" + smtpServer.port -} - // Possibly take the email config, an attachment and some array of recipients? func sendEmail() { @@ -33,7 +24,7 @@ func sendEmail() { // // TODO: Subject, message to be added to datasource config? Or schedule config? m.SetHeader("Subject", "Hello!") m.SetBody("text/html", "Hello") - // m.Attach("lolcat.jpg") + m.Attach("./data/Book1.xlsx") // // I don't really know what I'm doing with this auth. // // PlainAuth works and reading the docs it seems to fail @@ -102,7 +93,7 @@ func createReports() { // { {scheduleID}: excelFilePath } // f := excelize.NewFile() - f, e := excelize.OpenFile("test.xlsx") + f, e := excelize.OpenFile("./data/test.xlsx") if e != nil { log.DefaultLogger.Error("erorr opening", e.Error()) @@ -149,6 +140,7 @@ func cleanup() { func getScheduler(sqlite *SQLiteDatasource) func() { return func() { log.DefaultLogger.Info("Scheduler!") + createReports() sendEmail() log.DefaultLogger.Info("Scheduler2!")