company feedback performance update
This commit is contained in:
@@ -47,6 +47,7 @@ type TenderDocumentDownload struct {
|
||||
type Service interface {
|
||||
// Tender operations
|
||||
GetByID(ctx context.Context, id string, language string) (*TenderResponse, error)
|
||||
GetByIDs(ctx context.Context, ids []string) (map[string]*TenderResponse, error)
|
||||
Update(ctx context.Context, req UpdateTenderRequest) (*TenderResponse, error)
|
||||
Delete(ctx context.Context, id string) error
|
||||
Search(ctx context.Context, req *SearchForm, pagination *response.Pagination) (*SearchResponse, error)
|
||||
@@ -82,7 +83,7 @@ type tenderService struct {
|
||||
}
|
||||
|
||||
const (
|
||||
aiSummaryEnrichmentTimeout = 2 * time.Second
|
||||
aiSummaryEnrichmentTimeout = 2 * time.Second
|
||||
aiTranslationEnrichmentTimeout = 2 * time.Second
|
||||
)
|
||||
|
||||
@@ -128,6 +129,30 @@ func (s *tenderService) GetByID(ctx context.Context, id string, language string)
|
||||
return s.buildDetailResponse(ctx, tender, language), nil
|
||||
}
|
||||
|
||||
// GetByIDs loads multiple tenders for list endpoints without MinIO or AI enrichment.
|
||||
func (s *tenderService) GetByIDs(ctx context.Context, ids []string) (map[string]*TenderResponse, error) {
|
||||
if len(ids) == 0 {
|
||||
return map[string]*TenderResponse{}, nil
|
||||
}
|
||||
|
||||
tenders, err := s.repository.GetByIDs(ctx, ids)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to retrieve tenders by IDs", map[string]interface{}{
|
||||
"count": len(ids),
|
||||
"error": err.Error(),
|
||||
})
|
||||
return nil, fmt.Errorf("failed to retrieve tenders: %w", err)
|
||||
}
|
||||
|
||||
out := make(map[string]*TenderResponse, len(tenders))
|
||||
for i := range tenders {
|
||||
resp := tenders[i].ToResponseWithLanguage("")
|
||||
out[resp.ID] = resp
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// buildDetailResponse maps a tender to API form and enriches translation (MinIO) and summary.
|
||||
func (s *tenderService) buildDetailResponse(ctx context.Context, tender *Tender, language string) *TenderResponse {
|
||||
resp := tender.ToResponseWithLanguage("")
|
||||
@@ -1271,8 +1296,8 @@ func (s *tenderService) ListTendersWithScrapedDocuments(ctx context.Context, pag
|
||||
}
|
||||
|
||||
s.logger.Info("Listing tenders with scraped documents from MinIO", map[string]interface{}{
|
||||
"limit": pagination.Limit,
|
||||
"offset": pagination.Offset,
|
||||
"limit": pagination.Limit,
|
||||
"offset": pagination.Offset,
|
||||
"sync_mongo_metadata": syncMongoMetadata,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user