fix: more refactoring #181
Some checks failed
Build Docker Image / Build-Docker-Image (push) Failing after 1m43s

This commit is contained in:
2024-10-20 15:02:39 +02:00
parent d3ff302d3e
commit cf96c9be5b
6 changed files with 153 additions and 56 deletions

View File

@@ -16,18 +16,21 @@ func GetHandler(d *sql.DB, serverSettings *types.ServerSettings) http.Handler {
randomGenerator := service.NewRandomGeneratorImpl()
clock := service.NewClockImpl()
dbAuth := db.NewDbAuthSqlite(d)
dbWorkout := db.NewDbWorkoutSqlite(d)
mailService := service.NewMailServiceImpl(serverSettings)
serviceAuth := service.NewServiceAuthImpl(dbAuth, randomGenerator, clock, mailService, serverSettings)
serviceWorkout := service.NewServiceWorkoutImpl(dbWorkout, randomGenerator, clock, mailService, serverSettings)
handlerIndex := NewHandlerIndex(d, serviceAuth, serverSettings)
handlerAuth := NewHandlerAuth(d, serviceAuth, serverSettings)
handlerWorkout := NewHandlerWorkout(d, serviceWorkout, serviceAuth, serverSettings)
handlerIndex.handle(router)
// Serve static files (CSS, JS and images)
router.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
handleWorkout(d, router, serverSettings)
handlerWorkout.handle(router)
handlerAuth.handle(router)