From b300ad869f424cdd26bcfc78635a27656836ca96 Mon Sep 17 00:00:00 2001 From: GrailFinder Date: Wed, 12 Jun 2024 09:13:05 +0300 Subject: Feat: add cron and defaults table --- cmd/start.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/start.go b/cmd/start.go index fa00786..f6a2267 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -2,8 +2,11 @@ package cmd import ( "apjournal/config" + "apjournal/internal/crons" + "apjournal/internal/database/repos" database "apjournal/internal/database/sql" "apjournal/internal/server" + "context" "os" "log/slog" @@ -34,7 +37,10 @@ var startCmd = &cobra.Command{ log.Error("failed to connect to db", "error", err) return } - srv := server.NewServer(cfg, log, db.Conn) + repo := repos.NewProvider(db.Conn) + srv := server.NewServer(cfg, log, repo) + cron := crons.NewCron(context.Background(), repo) + cron.StartCronJobs() // listen for new messages srv.Listen() }, -- cgit v1.2.3