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 -3
View File
@@ -19,19 +19,24 @@ func (a *AuthSvc) RegisterStaff(spec authdomain.RegisterStaffReq) (string, error
return "", err
}
user := authdomain.Staff{
staff := authdomain.Staff{
ID: uuid.NewString(),
Email: spec.Email,
Password: hashedPwd,
Username: spec.Username,
}
_, err = a.staffRepo.Create(&user)
_, err = a.staffRepo.Create(&staff)
if err != nil {
return "", errors.New(err.Error())
}
token, err := utils.GenerateToken(spec.Email)
authToken := authdomain.AuthToken{
Email: staff.Email,
SessionID: uuid.NewString(),
}
token, err := utils.GenerateToken(authToken)
if err != nil {
return "", errors.New(err.Error())
}