style: reformatted all files

This commit is contained in:
ITQ
2025-12-19 21:04:12 +03:00
parent d7320f2198
commit 5c89ca5f09
21 changed files with 288 additions and 107 deletions
+15 -5
View File
@@ -4,9 +4,10 @@ import (
"context"
"errors"
"google.golang.org/protobuf/types/known/emptypb"
"datarush/internal/user/middleware"
pb "datarush/pkg/api/user"
"google.golang.org/protobuf/types/known/emptypb"
)
type UserRepository interface {
@@ -28,7 +29,10 @@ func (s *UserService) GetProfile(ctx context.Context, req *pb.GetProfileRequest)
return s.repo.GetProfile(ctx, req.UserId)
}
func (s *UserService) RegisterForCompetition(ctx context.Context, req *pb.RegisterForCompetitionRequest) (*emptypb.Empty, error) {
func (s *UserService) RegisterForCompetition(
ctx context.Context,
req *pb.RegisterForCompetitionRequest,
) (*emptypb.Empty, error) {
userID, ok := ctx.Value(middleware.UserIDKey{}).(string)
if !ok {
return nil, errors.New("user ID not found in context")
@@ -38,7 +42,10 @@ func (s *UserService) RegisterForCompetition(ctx context.Context, req *pb.Regist
return &emptypb.Empty{}, err
}
func (s *UserService) UnregisterFromCompetition(ctx context.Context, req *pb.UnregisterFromCompetitionRequest) (*emptypb.Empty, error) {
func (s *UserService) UnregisterFromCompetition(
ctx context.Context,
req *pb.UnregisterFromCompetitionRequest,
) (*emptypb.Empty, error) {
userID, ok := ctx.Value(middleware.UserIDKey{}).(string)
if !ok {
return nil, errors.New("user ID not found in context")
@@ -48,10 +55,13 @@ func (s *UserService) UnregisterFromCompetition(ctx context.Context, req *pb.Unr
return &emptypb.Empty{}, err
}
func (s *UserService) ListUserCompetitions(ctx context.Context, req *pb.ListUserCompetitionsRequest) (*pb.ListUserCompetitionsResponse, error) {
func (s *UserService) ListUserCompetitions(
ctx context.Context,
req *pb.ListUserCompetitionsRequest,
) (*pb.ListUserCompetitionsResponse, error) {
competitionIDs, err := s.repo.ListUserCompetitions(ctx, req.UserId)
if err != nil {
return nil, err
}
return &pb.ListUserCompetitionsResponse{CompetitionIds: competitionIDs}, nil
}
}
+2 -2
View File
@@ -9,8 +9,8 @@ import (
"datarush/internal/user/service/mocks"
pb "datarush/pkg/api/user"
"go.uber.org/mock/gomock"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)
func TestUserService(t *testing.T) {
@@ -98,4 +98,4 @@ func TestUserService(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, expectedError, err)
})
}
}