add service
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m24s

This commit is contained in:
vallyenfail
2026-01-18 01:48:46 +03:00
parent b6f7323c58
commit 80e5f318a9
23 changed files with 2300 additions and 26 deletions

View File

@@ -9,6 +9,27 @@ import (
"go.uber.org/zap"
)
func (h *AuthHandler) Register(ctx context.Context, req *pb.RegisterRequest) (*pb.RegisterResponse, error) {
accessToken, refreshToken, err := h.authService.Register(
ctx,
req.Email,
req.Password,
req.Name,
req.Phone,
req.InviteCode,
req.Ip,
req.UserAgent,
)
if err != nil {
return nil, errors.ToGRPCError(err, h.logger, "AuthService.Register")
}
return &pb.RegisterResponse{
AccessToken: accessToken,
RefreshToken: refreshToken,
}, nil
}
func (h *AuthHandler) Login(ctx context.Context, req *pb.LoginRequest) (*pb.LoginResponse, error) {
accessToken, refreshToken, err := h.authService.Login(
ctx,

View File

@@ -58,7 +58,7 @@ func NewHandlers(pool *pgxpool.Pool, jwtSecret, cryptoSecret, openAIKey, perplex
openAIClient := ai.NewOpenAIClient(openAIKey)
perplexityClient := ai.NewPerplexityClient(perplexityKey)
authService := service.NewAuthService(userRepo, sessionRepo, jwtSecret, cryptoSecret)
authService := service.NewAuthService(userRepo, sessionRepo, inviteRepo, txManager, jwtSecret, cryptoSecret)
userService := service.NewUserService(userRepo, requestRepo, cryptoSecret)
inviteService := service.NewInviteService(inviteRepo, userRepo, txManager)
requestService := service.NewRequestService(requestRepo, supplierRepo, tokenUsageRepo, userRepo, openAIClient, perplexityClient, txManager)