🐛 Fixed unused profiles repository in auth module

This commit is contained in:
Maxim Lebedev 2022-01-30 22:57:59 +05:00
parent cda8fe433d
commit 88ef37c6ff
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
4 changed files with 4 additions and 8 deletions

View File

@ -141,7 +141,7 @@ func (h *RequestHandler) Register(r *router.Router) {
provider := string(ctx.QueryArgs().Peek("provider")) provider := string(ctx.QueryArgs().Peek("provider"))
return !ctx.IsPost() || !matched || return !ctx.IsPost() || !matched ||
(provider != "" && provider != domain.DefaultProviderDirect.UID) (provider != "" && provider != domain.ProviderDirect.UID)
}, },
Validator: func(ctx *http.RequestCtx, login, password string) (bool, error) { Validator: func(ctx *http.RequestCtx, login, password string) (bool, error) {
// TODO(toby3d): change this // TODO(toby3d): change this

View File

@ -50,7 +50,6 @@ func TestRender(t *testing.T) {
Matcher: language.NewMatcher(message.DefaultCatalog.Languages()), Matcher: language.NewMatcher(message.DefaultCatalog.Languages()),
Auth: ucase.NewAuthUseCase( Auth: ucase.NewAuthUseCase(
sessionrepo.NewMemorySessionRepository(config, store), sessionrepo.NewMemorySessionRepository(config, store),
profilerepo.NewMemoryProfileRepository(store),
config, config,
), ),
}).Register(r) }).Register(r)

View File

@ -6,22 +6,19 @@ import (
"source.toby3d.me/website/indieauth/internal/auth" "source.toby3d.me/website/indieauth/internal/auth"
"source.toby3d.me/website/indieauth/internal/domain" "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/random"
"source.toby3d.me/website/indieauth/internal/session" "source.toby3d.me/website/indieauth/internal/session"
) )
type authUseCase struct { type authUseCase struct {
config *domain.Config config *domain.Config
profiles profile.Repository
sessions session.Repository sessions session.Repository
} }
// NewAuthUseCase creates a new authentication use case. // 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{ return &authUseCase{
config: config, config: config,
profiles: profiles,
sessions: sessions, sessions: sessions,
} }
} }

View File

@ -167,14 +167,14 @@ func main() {
WriteTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second,
MaxConnWaitTimeout: 10 * time.Second, MaxConnWaitTimeout: 10 * time.Second,
} }
ticketService := ticketucase.NewTicketUseCase(tickets, httpClient) ticketService := ticketucase.NewTicketUseCase(tickets, httpClient, config)
tokenService := tokenucase.NewTokenUseCase(tokens, sessions, config) tokenService := tokenucase.NewTokenUseCase(tokens, sessions, config)
r := router.New() r := router.New()
tickethttpdelivery.NewRequestHandler(ticketService, matcher, config).Register(r) tickethttpdelivery.NewRequestHandler(ticketService, matcher, config).Register(r)
healthhttpdelivery.NewRequestHandler().Register(r) healthhttpdelivery.NewRequestHandler().Register(r)
metadatahttpdelivery.NewRequestHandler(config).Register(r) metadatahttpdelivery.NewRequestHandler(config).Register(r)
tokenhttpdelivery.NewRequestHandler(tokenService).Register(r) tokenhttpdelivery.NewRequestHandler(tokenService, ticketService).Register(r)
clienthttpdelivery.NewRequestHandler(clienthttpdelivery.NewRequestHandlerOptions{ clienthttpdelivery.NewRequestHandler(clienthttpdelivery.NewRequestHandlerOptions{
Client: client, Client: client,
Config: config, Config: config,