Skip to content

Commit

Permalink
fix(auth): signup return type service
Browse files Browse the repository at this point in the history
  • Loading branch information
macgeargear committed Jun 23, 2024
1 parent 14602d8 commit 44dc5fd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/go-playground/validator/v10 v10.20.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.6.0
github.com/isd-sgcu/rpkm67-go-proto v0.0.4
github.com/isd-sgcu/rpkm67-go-proto v0.0.7
github.com/joho/godotenv v1.5.1
github.com/stretchr/testify v1.9.0
github.com/swaggo/files v1.0.1
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/isd-sgcu/rpkm67-go-proto v0.0.4 h1:ZO1m0EfTtjQ2IcRy6mUHj+mAb4loM3ckeisKefKqKmY=
github.com/isd-sgcu/rpkm67-go-proto v0.0.4/go.mod h1:Z5SYz5kEe4W+MdqPouF0zEOiaqvg+s9I1S5d0q6e+Jw=
github.com/isd-sgcu/rpkm67-go-proto v0.0.5 h1:8zTvNQ0NPokoVRK/NQJYxWjcBFMZNK0avotPs9RSPh0=
github.com/isd-sgcu/rpkm67-go-proto v0.0.5/go.mod h1:Z5SYz5kEe4W+MdqPouF0zEOiaqvg+s9I1S5d0q6e+Jw=
github.com/isd-sgcu/rpkm67-go-proto v0.0.6 h1:alECc0pLyJmbJ2cLBukNDplka+ucWutR6yLXqAn0lJM=
github.com/isd-sgcu/rpkm67-go-proto v0.0.6/go.mod h1:Z5SYz5kEe4W+MdqPouF0zEOiaqvg+s9I1S5d0q6e+Jw=
github.com/isd-sgcu/rpkm67-go-proto v0.0.7 h1:BrHjp7hDFmXTMuMKuA4mK3bjtHTvzozO0vYC1hV1a+w=
github.com/isd-sgcu/rpkm67-go-proto v0.0.7/go.mod h1:Z5SYz5kEe4W+MdqPouF0zEOiaqvg+s9I1S5d0q6e+Jw=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down
14 changes: 7 additions & 7 deletions internal/auth/auth.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
type Service interface {
Validate()
RefreshToken()
SignUp(req *dto.SignUpRequest) (*dto.Credential, *apperror.AppError)
SignUp(req *dto.SignUpRequest) (*dto.SignupResponse, *apperror.AppError)
SignIn(req *dto.SignInRequest) (*dto.Credential, *apperror.AppError)
SignOut(req *dto.TokenPayloadAuth) (*dto.SignOutResponse, *apperror.AppError)
ForgotPassword(req *dto.ForgotPasswordRequest) (*dto.ForgotPasswordResponse, *apperror.AppError)
Expand All @@ -39,7 +39,7 @@ func (s *serviceImpl) Validate() {
func (s *serviceImpl) RefreshToken() {
}

func (s *serviceImpl) SignUp(req *dto.SignUpRequest) (*dto.Credential, *apperror.AppError) {
func (s *serviceImpl) SignUp(req *dto.SignUpRequest) (*dto.SignupResponse, *apperror.AppError) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

Expand All @@ -48,7 +48,6 @@ func (s *serviceImpl) SignUp(req *dto.SignUpRequest) (*dto.Credential, *apperror
Password: req.Password,
Firstname: req.Firstname,
Lastname: req.Lastname,
Role: "student",
})
if err != nil {
st, ok := status.FromError(err)
Expand All @@ -65,10 +64,11 @@ func (s *serviceImpl) SignUp(req *dto.SignUpRequest) (*dto.Credential, *apperror
}
}

return &dto.Credential{
AccessToken: res.Credential.AccessToken,
RefreshToken: res.Credential.RefreshToken,
ExpiresIn: int(res.Credential.ExpiresIn),
return &dto.SignupResponse{
Id: res.Id,
Email: res.Email,
Firstname: res.Firstname,
Lastname: res.Lastname,
}, nil
}

Expand Down
1 change: 0 additions & 1 deletion internal/selection/test/selection.handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (t *SelectionHandlerTest) SetupTest() {

t.Selections = selection.ProtoToDtoList(selectionsProto)
t.Selection = selection.ProtoToDto(selectionProto)
// updatedSelection := selection.ProtoToDto(selectionsProto[2])

t.CreateSelectionReq = &dto.CreateSelectionRequest{}
t.FindByGroupIdSelectionReq = &dto.FindByGroupIdSelectionRequest{
Expand Down

0 comments on commit 44dc5fd

Please sign in to comment.