delete minipart from core
This commit is contained in:
parent
f8a30dc50c
commit
b8a9c48716
@ -13,7 +13,6 @@ import (
|
|||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/healthchecks"
|
"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/middleware"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
"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/brokers"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/initialize"
|
"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/"`
|
HubAdminUrl string `env:"HUB_ADMIN_URL" default:"http://localhost:8001/"`
|
||||||
ServiceName string `env:"SERVICE_NAME" default:"squiz"`
|
ServiceName string `env:"SERVICE_NAME" default:"squiz"`
|
||||||
AuthServiceURL string `env:"AUTH_URL" default:"http://localhost:8000/"`
|
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"`
|
GrpcHost string `env:"GRPC_HOST" default:"localhost"`
|
||||||
GrpcPort string `env:"GRPC_PORT" default:"9000"`
|
GrpcPort string `env:"GRPC_PORT" default:"9000"`
|
||||||
KafkaBrokers string `env:"KAFKA_BROKERS" default:"localhost:9092"`
|
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,
|
Port: options.GrpcPort,
|
||||||
})
|
})
|
||||||
|
|
||||||
encrypt := utils.NewEncrypt(options.PubKey, options.PrivKey)
|
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
app.Use(middleware.JWTAuth())
|
app.Use(middleware.JWTAuth())
|
||||||
app.Get("/liveness", healthchecks.Liveness)
|
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{
|
svc := service.New(service.Deps{
|
||||||
Dal: pgdal,
|
Dal: pgdal,
|
||||||
AuthClient: authClient,
|
AuthClient: authClient,
|
||||||
RedirectURl: options.RedirectURL,
|
|
||||||
Encrypt: encrypt,
|
|
||||||
Producer: producer,
|
Producer: producer,
|
||||||
ServiceName: options.ServiceName,
|
ServiceName: options.ServiceName,
|
||||||
})
|
})
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"net/url"
|
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/middleware"
|
"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/model"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/repository/quiz"
|
"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)
|
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 {
|
func (s *Service) TemplateCopy(ctx *fiber.Ctx) error {
|
||||||
accountID, ok := middleware.GetAccountId(ctx)
|
accountID, ok := middleware.GetAccountId(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -3,7 +3,6 @@ package service
|
|||||||
import (
|
import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
|
"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/brokers"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/clients/auth"
|
||||||
)
|
)
|
||||||
@ -11,8 +10,6 @@ import (
|
|||||||
// Service is an entity for http requests handling
|
// Service is an entity for http requests handling
|
||||||
type Service struct {
|
type Service struct {
|
||||||
dal *dal.DAL
|
dal *dal.DAL
|
||||||
redirectURl string
|
|
||||||
encrypt *utils.Encrypt
|
|
||||||
authClient *auth.AuthClient
|
authClient *auth.AuthClient
|
||||||
producer *brokers.Producer
|
producer *brokers.Producer
|
||||||
serviceName string
|
serviceName string
|
||||||
@ -20,8 +17,6 @@ type Service struct {
|
|||||||
|
|
||||||
type Deps struct {
|
type Deps struct {
|
||||||
Dal *dal.DAL
|
Dal *dal.DAL
|
||||||
RedirectURl string
|
|
||||||
Encrypt *utils.Encrypt
|
|
||||||
AuthClient *auth.AuthClient
|
AuthClient *auth.AuthClient
|
||||||
Producer *brokers.Producer
|
Producer *brokers.Producer
|
||||||
ServiceName string
|
ServiceName string
|
||||||
@ -30,8 +25,6 @@ type Deps struct {
|
|||||||
func New(deps Deps) *Service {
|
func New(deps Deps) *Service {
|
||||||
return &Service{
|
return &Service{
|
||||||
dal: deps.Dal,
|
dal: deps.Dal,
|
||||||
redirectURl: deps.RedirectURl,
|
|
||||||
encrypt: deps.Encrypt,
|
|
||||||
authClient: deps.AuthClient,
|
authClient: deps.AuthClient,
|
||||||
producer: deps.Producer,
|
producer: deps.Producer,
|
||||||
serviceName: deps.ServiceName,
|
serviceName: deps.ServiceName,
|
||||||
@ -49,7 +42,6 @@ func (s *Service) Register(app *fiber.App) {
|
|||||||
app.Delete("/quiz/delete", s.DeleteQuiz)
|
app.Delete("/quiz/delete", s.DeleteQuiz)
|
||||||
app.Patch("/quiz/archive", s.ArchiveQuiz)
|
app.Patch("/quiz/archive", s.ArchiveQuiz)
|
||||||
app.Post("/quiz/move", s.QuizMove)
|
app.Post("/quiz/move", s.QuizMove)
|
||||||
app.Get("/quiz/logo", s.MiniPart)
|
|
||||||
app.Post("/quiz/template", s.TemplateCopy)
|
app.Post("/quiz/template", s.TemplateCopy)
|
||||||
|
|
||||||
// question manipulating handlers
|
// question manipulating handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user