Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina committed Oct 8, 2024
1 parent 44019f4 commit 3214d87
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions core/user/mocks/user_repository.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/user/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (s Service) FetchCurrentUser(ctx context.Context) (User, error) {

func (s Service) Delete(ctx context.Context, id string) error {
if uuid.IsValid(id) {
return s.repository.DeleteById(ctx, id, s.config.InactiveEmailTag)
return s.repository.DeleteByID(ctx, id, s.config.InactiveEmailTag)
}
return s.repository.DeleteByEmail(ctx, id, s.config.InactiveEmailTag)
}
2 changes: 1 addition & 1 deletion core/user/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func TestService_DeleteUser(t *testing.T) {
repository := &mocks.Repository{}
activityService := &mocks.ActivityService{}
repository.EXPECT().
DeleteById(mock.Anything, testUserID, emailTag).
DeleteByID(mock.Anything, testUserID, emailTag).
Return(user.ErrNotExist)
return user.NewService(logger, user.Config{InactiveEmailTag: emailTag}, repository, activityService)
},
Expand Down
2 changes: 1 addition & 1 deletion core/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Repository interface {
UpdateByEmail(ctx context.Context, toUpdate User) (User, error)
CreateMetadataKey(ctx context.Context, key UserMetadataKey) (UserMetadataKey, error)
DeleteByEmail(ctx context.Context, email string, emailTag string) error
DeleteById(ctx context.Context, id string, emailTag string) error
DeleteByID(ctx context.Context, id string, emailTag string) error
}

type User struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/store/postgres/user_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ func (r UserRepository) DeleteByEmail(ctx context.Context, email string, emailTa
return nil
}

func (r UserRepository) DeleteById(ctx context.Context, id string, emailTag string) error {
func (r UserRepository) DeleteByID(ctx context.Context, id string, emailTag string) error {
user, err := r.GetByID(ctx, id)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion internal/store/postgres/user_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ func (s *UserRepositoryTestSuite) TestDeleteByID() {

for _, tc := range testCases {
s.Run(tc.Description, func() {
err := s.repository.DeleteById(s.ctx, tc.Email, emailTag)
err := s.repository.DeleteByID(s.ctx, tc.Email, emailTag)
if tc.Err != nil && tc.Err.Error() != "" {
if errors.Unwrap(err) == tc.Err {
s.T().Fatalf("got error %s, expected was %s", err.Error(), tc.Err)
Expand Down

0 comments on commit 3214d87

Please sign in to comment.