Cleanup fileservice and dataservice

This commit is contained in:
Guntis Smaukstelis
2023-12-17 22:48:24 +02:00
parent 578fdd778f
commit 2aa6c5f43c
12 changed files with 73 additions and 379 deletions
+3 -6
View File
@@ -2,7 +2,7 @@ package app
import cats.effect._
import cats.implicits.catsSyntaxTuple2Parallel
import db.{DBConnection, DataService, FileService, PostgresService}
import db.{DBConnection, PostgresService}
import fetch.{FetchService, FileFetchScheduler}
import server.Server
@@ -15,15 +15,12 @@ object Main extends IOApp {
transactor <- DBConnection.transactor[IO]
postgresService <- PostgresService.of(transactor)
_ <- postgresService.createWeatherTable // create table if it does not exists
fileService <- FileService.of
dataService <- DataService.of(fileService, postgresService)
// dataService <- DataService.of(fileService)
fetch <- FetchService.of
fileFetchScheduler <- FileFetchScheduler.of(dataService, fetch)
fileFetchScheduler <- FileFetchScheduler.of(postgresService, fetch)
schedulerTask = fileFetchScheduler.run.compile.drain
server <- Server.of(dataService, fetch)
server <- Server.of(postgresService, fetch)
serverTask = server.run
exitCode <- (serverTask, schedulerTask).parMapN((_, _) => ExitCode.Success)