remove auth client from common
This commit is contained in:
parent
cdd3d30cbb
commit
ba856db178
@ -96,7 +96,7 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
|
||||
|
||||
authClient := auth.NewAuthClient(options.AuthServiceURL)
|
||||
|
||||
pgdal, err := dal.New(ctx, options.PostgresCredentials, authClient, nil)
|
||||
pgdal, err := dal.New(ctx, options.PostgresCredentials, nil)
|
||||
if err != nil {
|
||||
fmt.Println("NEW", err)
|
||||
return nil, err
|
||||
@ -124,6 +124,7 @@ 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,
|
||||
})
|
||||
|
BIN
core.git
Executable file
BIN
core.git
Executable file
Binary file not shown.
2
go.mod
2
go.mod
@ -15,7 +15,7 @@ require (
|
||||
github.com/xuri/excelize/v2 v2.8.1
|
||||
go.uber.org/zap v1.27.0
|
||||
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240223054633-6cb3d5ce45b6
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240412164014-6ce70d76fedc
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240416102930-a84f95429fb9
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3
|
||||
)
|
||||
|
||||
|
6
go.sum
6
go.sum
@ -277,5 +277,11 @@ penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240410152249-f16
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240410152249-f16ff4921566/go.mod h1:/DcyAjBh41IbomuDu5QzhL9flZW6lWO3ZAEbUXKobk0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240412164014-6ce70d76fedc h1:B9X8pOrqWPGbWZNXSJEUk/8GWeBDGQmMKgQ0F+PSliQ=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240412164014-6ce70d76fedc/go.mod h1:/DcyAjBh41IbomuDu5QzhL9flZW6lWO3ZAEbUXKobk0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240413232604-40d8b15b2411 h1:e3bRYVKpdA9eR6Kkx1qbAYynvYDhYg5rCSWsX8fZ4W0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240413232604-40d8b15b2411/go.mod h1:/DcyAjBh41IbomuDu5QzhL9flZW6lWO3ZAEbUXKobk0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240416095332-bf692017b2fe h1:7T3eDAMRotRboBgw8UVu1t3pLvfQQCzbE5pppX1XCY8=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240416095332-bf692017b2fe/go.mod h1:/DcyAjBh41IbomuDu5QzhL9flZW6lWO3ZAEbUXKobk0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240416102930-a84f95429fb9 h1:8nn6sny017tca9HAxd0QzSzszoSzxAC7pYtziw1trDM=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240416102930-a84f95429fb9/go.mod h1:/DcyAjBh41IbomuDu5QzhL9flZW6lWO3ZAEbUXKobk0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3 h1:BLHIUnJAttW9OAW7A63H9ON/HPhXdpBa/YPUQWD4ORA=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240313171802-7da5fbb4caf3/go.mod h1:/BFcX4F10DRuFuAHlwkKO+1QAXPL4i49x1tsrTwxlqE=
|
||||
|
@ -77,9 +77,15 @@ func (s *Service) createAccount(ctx *fiber.Ctx) error {
|
||||
return ctx.Status(fiber.StatusConflict).SendString("user with this ID already exists")
|
||||
}
|
||||
|
||||
email, err := s.authClient.GetUserEmail(accountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
newAccount := model.Account{
|
||||
UserID: accountID,
|
||||
CreatedAt: time.Now(),
|
||||
Email: email,
|
||||
Deleted: false,
|
||||
Privileges: map[string]model.ShortPrivilege{
|
||||
"quizUnlimTime": {
|
||||
|
@ -4,6 +4,7 @@ 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/clients/auth"
|
||||
)
|
||||
|
||||
// Service is an entity for http requests handling
|
||||
@ -11,16 +12,23 @@ type Service struct {
|
||||
dal *dal.DAL
|
||||
redirectURl string
|
||||
encrypt *utils.Encrypt
|
||||
authClient *auth.AuthClient
|
||||
}
|
||||
|
||||
type Deps struct {
|
||||
Dal *dal.DAL
|
||||
RedirectURl string
|
||||
Encrypt *utils.Encrypt
|
||||
AuthClient *auth.AuthClient
|
||||
}
|
||||
|
||||
func New(deps Deps) *Service {
|
||||
return &Service{dal: deps.Dal, redirectURl: deps.RedirectURl, encrypt: deps.Encrypt}
|
||||
return &Service{
|
||||
dal: deps.Dal,
|
||||
redirectURl: deps.RedirectURl,
|
||||
encrypt: deps.Encrypt,
|
||||
authClient: deps.AuthClient,
|
||||
}
|
||||
}
|
||||
|
||||
// Register is a function for add handlers of service to external multiplexer
|
||||
|
Loading…
Reference in New Issue
Block a user