diff --git a/go.mod b/go.mod index 95730d2..304e79f 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index e62b602..d3c9f1b 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/auth/auth.service.go b/internal/auth/auth.service.go index 6141ad9..1d61b38 100644 --- a/internal/auth/auth.service.go +++ b/internal/auth/auth.service.go @@ -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) @@ -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() @@ -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) @@ -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 } diff --git a/internal/selection/test/selection.handler_test.go b/internal/selection/test/selection.handler_test.go index ee50f39..1a57a64 100644 --- a/internal/selection/test/selection.handler_test.go +++ b/internal/selection/test/selection.handler_test.go @@ -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{