Skip to content

Commit

Permalink
Added authClient
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan Karpov committed May 11, 2023
1 parent d4c1190 commit ad86cbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/app/service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func newServiceProvider() *serviceProvider {
return &serviceProvider{}
}

func (s *serviceProvider) ChatService(_ context.Context) chatService.Service {
func (s *serviceProvider) ChatService(ctx context.Context) chatService.Service {
if s.chatService == nil {
s.chatService = chatService.NewService()
s.chatService = chatService.NewService(s.AuthClient(ctx))
}

return s.chatService
Expand Down
9 changes: 7 additions & 2 deletions internal/service/chat/service.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package chat

import authClient "github.com/satanaroom/chat_server/internal/clients/grpc/auth"

var _ Service = (*service)(nil)

type Service interface {
}

type service struct {
authClient authClient.Client
}

func NewService() *service {
return &service{}
func NewService(authClient authClient.Client) *service {
return &service{
authClient: authClient,
}
}

0 comments on commit ad86cbc

Please sign in to comment.