chores: refactor struct and structure project

This commit is contained in:
ericprd
2025-03-05 21:21:44 +08:00
parent 13a8481f22
commit 567e0e32ca
103 changed files with 1125 additions and 731 deletions
+5 -3
View File
@@ -4,12 +4,13 @@ import (
"errors"
authdomain "legalgo-BE-go/internal/domain/auth"
userdomain "legalgo-BE-go/internal/domain/user"
"legalgo-BE-go/internal/utilities/utils"
"github.com/google/uuid"
)
func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error) {
func (a *impl) RegisterUser(spec userdomain.UserRegister) (string, error) {
_, err := a.userRepo.GetUserByEmail(spec.Email)
if err == nil {
@@ -40,7 +41,7 @@ func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error)
return "", err
}
user := authdomain.User{
user := userdomain.User{
ID: uuid.NewString(),
Email: spec.Email,
SubscribeID: subsId,
@@ -48,7 +49,7 @@ func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error)
Phone: spec.Phone,
}
_, err = a.userRepo.CreateUser(&user)
err = a.userRepo.CreateUser(user)
if err != nil {
return "", errors.New(err.Error())
}
@@ -56,6 +57,7 @@ func (a *AuthSvc) RegisterUser(spec authdomain.RegisterUserReq) (string, error)
authToken := authdomain.AuthToken{
Email: user.Email,
SessionID: uuid.NewString(),
Role: "user",
}
token, err := utils.GenerateToken(authToken)