modified: main_dc/docker-compose.yml
modified: main_dc/yalarba/api_yal/cmd/main.go modified: main_dc/yalarba/api_yal/internal/domain/auth/dto.go modified: main_dc/yalarba/api_yal/internal/domain/auth/handler.go modified: main_dc/yalarba/api_yal/internal/domain/auth/servcie.go add AuthRes and UserInfo structs for request after auth
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
package auth
|
||||
|
||||
import ()
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"api_yal/internal/logger"
|
||||
"api_yal/internal/models"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
type AuthService struct {
|
||||
}
|
||||
@@ -8,4 +15,20 @@ type AuthService struct {
|
||||
func NewAuthService() *AuthService {
|
||||
return &AuthService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AuthService) Register(regReq RegisterRequest) (AuthResponse, error) {
|
||||
l := logger.Get()
|
||||
l.Debug("Регистрация пользователя AuthSerice")
|
||||
|
||||
// Хешируем пароль
|
||||
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(regReq.Password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newAcc := &models.Account{
|
||||
Email: regReq.Email,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user