Skip to content

Commit

Permalink
Merge pull request #62 from nikhilnarayanan623/fix/sign-up-verify
Browse files Browse the repository at this point in the history
user sign-up verify database update issue fixed
  • Loading branch information
nikhilnarayanan623 authored Oct 7, 2023
2 parents a94a5e0 + 203eea5 commit 3193fb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 4 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ ${BINARY_DIR}:
mkdir -p $(BINARY_DIR)

build: ${BINARY_DIR} ## Compile the code, build Executable File
# $(GOCMD) build -o $(BINARY_DIR) -v ./cmd/api
GOARCH=amd64 $(GOCMD) build -v -o $(BINARY_DIR)/api-linux-amd64 ./cmd/api/main.go
$(GOCMD) build -o $(BINARY_DIR) -v ./cmd/api
# GOARCH=amd64 $(GOCMD) build -o $(BINARY_DIR)/api-linux-amd64 -v ./cmd/api/main.go

build-run: build ## run project build file if not exist build it
./$(BINARY_DIR)/api-linux-amd64
# ./$(BINARY_DIR)/api-linux-amd64
./$(BINARY_DIR)/api

run: ## Start application
$(GOCMD) run ./cmd/api/main.go
Expand Down
2 changes: 1 addition & 1 deletion pkg/repository/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *userDatabase) SaveUser(ctx context.Context, user domain.User) (userID u

createdAt := time.Now()
err = c.DB.Raw(query, user.UserName, user.FirstName, user.LastName,
user.Age, user.Email, user.Phone, user.Password, user.GoogleImage, createdAt).Scan(&user).Error
user.Age, user.Email, user.Phone, user.Password, user.GoogleImage, createdAt).Scan(&userID).Error

return userID, err
}
Expand Down
8 changes: 1 addition & 7 deletions pkg/usecase/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,6 @@ func (c *authUseCase) LoginOtpVerify(ctx context.Context, otpVerifyDetails reque
return 0, ErrInvalidOtp
}

if err := c.userRepo.UpdateVerified(ctx, otpSession.UserID); err != nil {

return 0, utils.PrependMessageToError(err, "failed to update user verified in db")

}

return otpSession.UserID, nil
}

Expand Down Expand Up @@ -378,7 +372,7 @@ func (c *authUseCase) SingUpOtpVerify(ctx context.Context,
return 0, ErrInvalidOtp
}

err = c.userRepo.UpdateVerified(ctx, otpSession.ID)
err = c.userRepo.UpdateVerified(ctx, otpSession.UserID)
if err != nil {
return 0, utils.PrependMessageToError(err, "failed to update user verified on database")
}
Expand Down

0 comments on commit 3193fb5

Please sign in to comment.