add tysc handlers to kontor-gin

This commit is contained in:
2026-09-30 04:12:03 +02:00
parent c848758821
commit f912dcb670
100 changed files with 2420 additions and 1064 deletions
+6 -13
View File
@@ -4,11 +4,8 @@ import (
"context"
"fmt"
"kontor-api-gin/internal/config"
"kontor-api-gin/internal/globals"
"kontor-api-gin/internal/handlers"
"kontor-api-gin/internal/repository"
"kontor-api-gin/internal/router"
"kontor-api-gin/internal/service"
"log"
"log/slog"
"net/http"
@@ -25,7 +22,7 @@ import (
func main() {
slog.Info("Kontor started")
if err := globals.InitConfig(); err != nil {
if err := config.InitConfig(); err != nil {
log.Fatalf("Failed to initialize config: %v", err)
}
@@ -46,11 +43,6 @@ func main() {
log.Fatal(err)
}
comicRepo := repository.NewComicRepository(db)
profileRepo := repository.NewProfileRepository(db)
comicService := service.NewComicService(comicRepo)
authService := service.NewAuthService(profileRepo, []byte(viper.GetString("api_secret")))
// Set Gin mode based on environment
// Production mode disables debug output
if viper.GetString("gin.mode") == "release" {
@@ -58,11 +50,12 @@ func main() {
}
r := router.New(
&handlers.ComicHandler{Service: comicService},
&handlers.AuthHandler{Service: authService},
[]byte(viper.GetString("api_secret")),
handlers.NewAdminHandler(db, []byte(viper.GetString("api_secret"))),
handlers.NewComicsHandler(db),
handlers.NewMediaHandler(db),
handlers.NewTyscHandler(db),
handlers.NewWebAppHandler(db, []byte(viper.GetString("api_secret"))),
)
// router.Use(sessions.Sessions("session", cookie.NewStore(globals.Secret)))
srv := &http.Server{
Addr: ":" + strconv.Itoa(viper.GetInt("port")),