fix: get profile user/staff using token rather than id

This commit is contained in:
ericprd
2025-02-28 12:18:47 +08:00
parent 5fb0764630
commit 6b858b99fb
15 changed files with 234 additions and 44 deletions
+8 -1
View File
@@ -5,6 +5,8 @@ import (
authdomain "legalgo-BE-go/internal/domain/auth"
"legalgo-BE-go/internal/utilities/utils"
"github.com/google/uuid"
)
func (a *AuthSvc) LoginAsUser(spec authdomain.LoginReq) (string, error) {
@@ -18,7 +20,12 @@ func (a *AuthSvc) LoginAsUser(spec authdomain.LoginReq) (string, error) {
return "", errors.New("wrong password")
}
token, err := utils.GenerateToken(user.Email)
authToken := authdomain.AuthToken{
Email: user.Email,
SessionID: uuid.NewString(),
}
token, err := utils.GenerateToken(authToken)
if err != nil {
return "", errors.New(err.Error())
}