From 6fb57c41c14fd8778974272097283f954efba7e7 Mon Sep 17 00:00:00 2001 From: Mazyar Date: Thu, 18 Jun 2026 20:56:31 +0330 Subject: [PATCH] Refactor ScrapePortalsResponse structure and update API documentation - Changed the ScrapePortalsResponse type to return a slice of strings representing portal identifiers instead of a structured object. - Updated the Swagger documentation for the GetScrapePortals endpoint to reflect the new response format, ensuring clarity in API usage. This update simplifies the response structure for the scraping portals, enhancing the API's usability and consistency. --- internal/ai_pipeline/handler.go | 2 +- pkg/ai_summarizer/entities.go | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/internal/ai_pipeline/handler.go b/internal/ai_pipeline/handler.go index 7b55e08..0128cf6 100644 --- a/internal/ai_pipeline/handler.go +++ b/internal/ai_pipeline/handler.go @@ -83,7 +83,7 @@ func (h *Handler) ScrapeDocumentsBatch(c echo.Context) error { // @Description Retrieve the list of document scraping portals supported by the Opplens AI service // @Tags Admin-AI-Pipeline // @Produce json -// @Success 200 {object} response.APIResponse{data=ai_summarizer.ScrapePortalsResponse} "Scrape portals retrieved successfully" +// @Success 200 {object} response.APIResponse{data=[]string} "Scrape portals retrieved successfully" // @Failure 401 {object} response.APIResponse // @Failure 500 {object} response.APIResponse // @Failure 503 {object} response.APIResponse diff --git a/pkg/ai_summarizer/entities.go b/pkg/ai_summarizer/entities.go index 3379bac..eb9176e 100644 --- a/pkg/ai_summarizer/entities.go +++ b/pkg/ai_summarizer/entities.go @@ -173,18 +173,8 @@ type ScrapeDocumentsBatchRequest struct { Tenders []TenderRef `json:"tenders"` } -// ScrapePortal describes one document scraping portal supported by the AI service. -type ScrapePortal struct { - ID string `json:"id"` - Name string `json:"name"` - CountryCode string `json:"country_code,omitempty"` - Countries []string `json:"countries,omitempty"` -} - -// ScrapePortalsResponse is returned by GET /scrape/portals. -type ScrapePortalsResponse struct { - Portals []ScrapePortal `json:"portals"` -} +// ScrapePortalsResponse is returned by GET /scrape/portals — portal identifiers. +type ScrapePortalsResponse []string // SummarizeBatchRequest is the payload for POST /ai/summarize/batch. type SummarizeBatchRequest struct {