From 905f28787de8b5b3568aa76a05f5637219a95fc3 Mon Sep 17 00:00:00 2001 From: Gear <84141000+macgeargear@users.noreply.github.com> Date: Sun, 23 Jun 2024 14:09:34 +0700 Subject: [PATCH] fix(auth): signup return type service --- internal/auth/auth.service.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 }