e5fa0dfe47
continuous-integration/drone/push Build is passing
- Introduced the GetScrapePortals method in the AI pipeline handler to list document scraping portals supported by the Opplens AI service. - Updated the service layer to include GetScrapePortals, which retrieves the portals from the client and handles errors appropriately. - Enhanced the routes to register the new endpoint for retrieving scrape portals. - Added a new error type for invalid date ranges in the document scraper, improving validation and error handling. This update expands the AI pipeline capabilities, allowing for better management of document scraping portals within the tender management system.
48 lines
1.7 KiB
Go
48 lines
1.7 KiB
Go
package document_scraper
|
|
|
|
// DocumentScraperListRequest represents the request to list tenders pending document scraping
|
|
type DocumentScraperListRequest struct {
|
|
Limit int `query:"limit" valid:"optional,range(1|100)"`
|
|
Offset int `query:"offset" valid:"optional,range(0|1000000)"`
|
|
CreatedAtFrom *int64 `query:"created_at_from" valid:"optional"`
|
|
CreatedAtTo *int64 `query:"created_at_to" valid:"optional"`
|
|
IncludeExpired bool `query:"include_expired" valid:"optional"`
|
|
}
|
|
|
|
// Normalize applies default pagination bounds.
|
|
func (r *DocumentScraperListRequest) Normalize() {
|
|
if r.Limit <= 0 {
|
|
r.Limit = 20
|
|
}
|
|
if r.Limit > 100 {
|
|
r.Limit = 100
|
|
}
|
|
if r.Offset < 0 {
|
|
r.Offset = 0
|
|
}
|
|
}
|
|
|
|
// DocumentScraperGetRequest represents the request to get a specific tender by notice publication ID
|
|
type DocumentScraperGetRequest struct {
|
|
NoticeID string `param:"notice_id" valid:"required~Notice ID is required"`
|
|
}
|
|
|
|
// DocumentScraperTenderResponse is the minimal payload for the document scraper pipeline.
|
|
//
|
|
// ContractFolderID and NoticePublicationID are used to build MinIO paths:
|
|
//
|
|
// PROC_<contract_folder_id>/<notice_publication_id>/documents/<file>
|
|
// PROC_<contract_folder_id>/<notice_publication_id>/tender.json
|
|
type DocumentScraperTenderResponse struct {
|
|
ContractFolderID string `json:"contract_folder_id"`
|
|
NoticePublicationID string `json:"notice_publication_id"`
|
|
DocumentURL string `json:"document_url"`
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// DocumentScraperListResponse represents the paginated list response
|
|
type DocumentScraperListResponse struct {
|
|
Tenders []DocumentScraperTenderResponse `json:"tenders"`
|
|
}
|