delete minipart from core

This commit is contained in:
Pavel 2024-06-01 16:26:25 +03:00
parent f8a30dc50c
commit b8a9c48716
3 changed files with 0 additions and 47 deletions

@ -13,7 +13,6 @@ import (
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/healthchecks"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/middleware"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/utils"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/brokers"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/initialize"
@ -58,9 +57,6 @@ type Options struct {
HubAdminUrl string `env:"HUB_ADMIN_URL" default:"http://localhost:8001/"`
ServiceName string `env:"SERVICE_NAME" default:"squiz"`
AuthServiceURL string `env:"AUTH_URL" default:"http://localhost:8000/"`
RedirectURL string `env:"REDIRECT_URL" default:"https://squiz.pena.digital"`
PubKey string `env:"PUBLIC_KEY"`
PrivKey string `env:"PRIVATE_KEY"`
GrpcHost string `env:"GRPC_HOST" default:"localhost"`
GrpcPort string `env:"GRPC_PORT" default:"9000"`
KafkaBrokers string `env:"KAFKA_BROKERS" default:"localhost:9092"`
@ -147,7 +143,6 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
Port: options.GrpcPort,
})
encrypt := utils.NewEncrypt(options.PubKey, options.PrivKey)
app := fiber.New()
app.Use(middleware.JWTAuth())
app.Get("/liveness", healthchecks.Liveness)
@ -156,8 +151,6 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
svc := service.New(service.Deps{
Dal: pgdal,
AuthClient: authClient,
RedirectURl: options.RedirectURL,
Encrypt: encrypt,
Producer: producer,
ServiceName: options.ServiceName,
})

@ -1,9 +1,7 @@
package service
import (
"fmt"
"github.com/gofiber/fiber/v2"
"net/url"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/middleware"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/repository/quiz"
@ -455,36 +453,6 @@ func (s *Service) QuizMove(ctx *fiber.Ctx) error {
return ctx.Status(fiber.StatusOK).JSON(resp)
}
func (s *Service) MiniPart(ctx *fiber.Ctx) error {
qid := ctx.Query("q")
if qid == "" {
return ctx.Status(fiber.StatusBadRequest).SendString("qid is nil")
}
ctx.Cookie(&fiber.Cookie{
Name: "quizFrom",
Value: qid,
})
userID, err := s.dal.AccountRepo.GetQidOwner(ctx.Context(), qid)
if err != nil {
return ctx.Status(fiber.StatusInternalServerError).SendString(err.Error())
}
shifr, err := s.encrypt.EncryptStr(userID)
if err != nil {
return ctx.Status(fiber.StatusInternalServerError).SendString(err.Error())
}
fmt.Println("OLOLO", string(shifr))
ctx.Cookie(&fiber.Cookie{
Name: "quizUser",
Value: url.QueryEscape(string(shifr)),
})
return ctx.Redirect(s.redirectURl, fiber.StatusFound)
}
func (s *Service) TemplateCopy(ctx *fiber.Ctx) error {
accountID, ok := middleware.GetAccountId(ctx)
if !ok {

@ -3,7 +3,6 @@ package service
import (
"github.com/gofiber/fiber/v2"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/utils"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/brokers"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
)
@ -11,8 +10,6 @@ import (
// Service is an entity for http requests handling
type Service struct {
dal *dal.DAL
redirectURl string
encrypt *utils.Encrypt
authClient *auth.AuthClient
producer *brokers.Producer
serviceName string
@ -20,8 +17,6 @@ type Service struct {
type Deps struct {
Dal *dal.DAL
RedirectURl string
Encrypt *utils.Encrypt
AuthClient *auth.AuthClient
Producer *brokers.Producer
ServiceName string
@ -30,8 +25,6 @@ type Deps struct {
func New(deps Deps) *Service {
return &Service{
dal: deps.Dal,
redirectURl: deps.RedirectURl,
encrypt: deps.Encrypt,
authClient: deps.AuthClient,
producer: deps.Producer,
serviceName: deps.ServiceName,
@ -49,7 +42,6 @@ func (s *Service) Register(app *fiber.App) {
app.Delete("/quiz/delete", s.DeleteQuiz)
app.Patch("/quiz/archive", s.ArchiveQuiz)
app.Post("/quiz/move", s.QuizMove)
app.Get("/quiz/logo", s.MiniPart)
app.Post("/quiz/template", s.TemplateCopy)
// question manipulating handlers