From 88ef37c6ffe46391392bee80e6f4eabf6ea2fc4d Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sun, 30 Jan 2022 22:57:59 +0500 Subject: [PATCH] :bug: Fixed unused profiles repository in auth module --- internal/auth/delivery/http/auth_http.go | 2 +- internal/auth/delivery/http/auth_http_test.go | 1 - internal/auth/usecase/auth_ucase.go | 5 +---- main.go | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/auth/delivery/http/auth_http.go b/internal/auth/delivery/http/auth_http.go index bac3d4b..3275aa4 100644 --- a/internal/auth/delivery/http/auth_http.go +++ b/internal/auth/delivery/http/auth_http.go @@ -141,7 +141,7 @@ func (h *RequestHandler) Register(r *router.Router) { provider := string(ctx.QueryArgs().Peek("provider")) return !ctx.IsPost() || !matched || - (provider != "" && provider != domain.DefaultProviderDirect.UID) + (provider != "" && provider != domain.ProviderDirect.UID) }, Validator: func(ctx *http.RequestCtx, login, password string) (bool, error) { // TODO(toby3d): change this diff --git a/internal/auth/delivery/http/auth_http_test.go b/internal/auth/delivery/http/auth_http_test.go index de7d023..1021a6e 100644 --- a/internal/auth/delivery/http/auth_http_test.go +++ b/internal/auth/delivery/http/auth_http_test.go @@ -50,7 +50,6 @@ func TestRender(t *testing.T) { Matcher: language.NewMatcher(message.DefaultCatalog.Languages()), Auth: ucase.NewAuthUseCase( sessionrepo.NewMemorySessionRepository(config, store), - profilerepo.NewMemoryProfileRepository(store), config, ), }).Register(r) diff --git a/internal/auth/usecase/auth_ucase.go b/internal/auth/usecase/auth_ucase.go index 9d65310..b55a89a 100644 --- a/internal/auth/usecase/auth_ucase.go +++ b/internal/auth/usecase/auth_ucase.go @@ -6,22 +6,19 @@ import ( "source.toby3d.me/website/indieauth/internal/auth" "source.toby3d.me/website/indieauth/internal/domain" - "source.toby3d.me/website/indieauth/internal/profile" "source.toby3d.me/website/indieauth/internal/random" "source.toby3d.me/website/indieauth/internal/session" ) type authUseCase struct { config *domain.Config - profiles profile.Repository sessions session.Repository } // NewAuthUseCase creates a new authentication use case. -func NewAuthUseCase(sessions session.Repository, profiles profile.Repository, config *domain.Config) auth.UseCase { +func NewAuthUseCase(sessions session.Repository, config *domain.Config) auth.UseCase { return &authUseCase{ config: config, - profiles: profiles, sessions: sessions, } } diff --git a/main.go b/main.go index f4ad120..112c810 100644 --- a/main.go +++ b/main.go @@ -167,14 +167,14 @@ func main() { WriteTimeout: 10 * time.Second, MaxConnWaitTimeout: 10 * time.Second, } - ticketService := ticketucase.NewTicketUseCase(tickets, httpClient) + ticketService := ticketucase.NewTicketUseCase(tickets, httpClient, config) tokenService := tokenucase.NewTokenUseCase(tokens, sessions, config) r := router.New() tickethttpdelivery.NewRequestHandler(ticketService, matcher, config).Register(r) healthhttpdelivery.NewRequestHandler().Register(r) metadatahttpdelivery.NewRequestHandler(config).Register(r) - tokenhttpdelivery.NewRequestHandler(tokenService).Register(r) + tokenhttpdelivery.NewRequestHandler(tokenService, ticketService).Register(r) clienthttpdelivery.NewRequestHandler(clienthttpdelivery.NewRequestHandlerOptions{ Client: client, Config: config,