From 2dd714b3694e334758bfaeae02c6eba05f5ff30d Mon Sep 17 00:00:00 2001 From: pasha1coil Date: Wed, 9 Jul 2025 14:43:14 +0300 Subject: [PATCH] - --- app/app.go | 12 ++---------- service/service.go | 16 ++-------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/app/app.go b/app/app.go index eb9062d..2a57e17 100644 --- a/app/app.go +++ b/app/app.go @@ -9,7 +9,6 @@ import ( "gitea.pena/SQuiz/common/dal" "gitea.pena/SQuiz/common/healthchecks" "gitea.pena/SQuiz/common/middleware" - "gitea.pena/SQuiz/common/utils" "github.com/gofiber/fiber/v2" "github.com/skeris/appInit" "go.uber.org/zap" @@ -47,9 +46,6 @@ type Options struct { CrtFile string `env:"CRT" default:"server.crt"` KeyFile string `env:"KEY" default:"server.key"` PostgresCredentials string `env:"PG_CRED" default:"host=localhost port=5432 user=squiz password=Redalert2 dbname=squiz sslmode=disable"` - RedirectURL string `env:"REDIRECT_URL" default:"https://squiz.pena.digital"` - PubKey string `env:"PUBLIC_KEY"` - PrivKey string `env:"PRIVATE_KEY"` } func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.CommonApp, error) { @@ -90,13 +86,9 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co zapLogger.Info("config", zap.Any("options", options)) - encrypt := utils.NewEncrypt(options.PubKey, options.PrivKey) - svc, err := service.New(service.ServiceDeps{ - Dal: pgdal, - Encrypt: encrypt, - RedirectURl: options.RedirectURL, - AiClient: clients.NewAiClient("https://alvatar.com/api/engine/send_answer"), + Dal: pgdal, + AiClient: clients.NewAiClient("https://alvatar.com/api/engine/send_answer"), }) if err != nil { zapLogger.Error("failed to create service", zap.Error(err)) diff --git a/service/service.go b/service/service.go index 25dde0d..ac2c510 100644 --- a/service/service.go +++ b/service/service.go @@ -7,11 +7,9 @@ import ( quizdal "gitea.pena/SQuiz/common/dal" "gitea.pena/SQuiz/common/middleware" "gitea.pena/SQuiz/common/model" - "gitea.pena/SQuiz/common/utils" "github.com/gofiber/fiber/v2" "strconv" "strings" - "sync" "time" "unicode/utf8" @@ -25,19 +23,13 @@ const ( type Service struct { dal *quizdal.DAL - batch []model.Answer - m sync.Mutex - encrypt *utils.Encrypt - redirectURl string aiClient *clients.AIClient quizConfigData GetQuizDataResp } type ServiceDeps struct { - Dal *quizdal.DAL - Encrypt *utils.Encrypt - RedirectURl string - AiClient *clients.AIClient + Dal *quizdal.DAL + AiClient *clients.AIClient } func New(deps ServiceDeps) (*Service, error) { @@ -48,10 +40,6 @@ func New(deps ServiceDeps) (*Service, error) { return &Service{ dal: deps.Dal, - m: sync.Mutex{}, - batch: []model.Answer{}, - encrypt: deps.Encrypt, - redirectURl: deps.RedirectURl, aiClient: deps.AiClient, quizConfigData: quizData, }, nil