add service
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m24s
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m24s
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user