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

This commit is contained in:
vallyenfail
2026-01-20 19:02:06 +03:00
parent f8db0fd9e6
commit 8b9554720d
15 changed files with 2109 additions and 38 deletions

View File

@@ -10,6 +10,7 @@ import (
"git.techease.ru/Smart-search/smart-search-back/internal/repository"
"git.techease.ru/Smart-search/smart-search-back/pkg/errors"
"git.techease.ru/Smart-search/smart-search-back/pkg/fileparser"
"git.techease.ru/Smart-search/smart-search-back/pkg/validation"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
)
@@ -45,6 +46,14 @@ func NewRequestService(
}
func (s *requestService) CreateTZ(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) (uuid.UUID, string, error) {
if err := validation.ValidateRequestTxt(requestTxt); err != nil {
return uuid.Nil, "", err
}
if err := validation.ValidateFileSize(len(fileData)); err != nil {
return uuid.Nil, "", err
}
combinedText := requestTxt
if len(fileData) > 0 && fileName != "" {