get all tenders with documeents scraped API

This commit is contained in:
Mazyar
2026-05-19 19:23:18 +03:30
parent fcf2cae6bc
commit f7763cf997
7 changed files with 306 additions and 2 deletions
+31
View File
@@ -69,6 +69,37 @@ type SearchResponse struct {
Metadata *response.Meta `json:"-"`
}
// TenderScrapedDocumentsItem is a tender that has scraped documents stored in the database.
type TenderScrapedDocumentsItem struct {
TenderID string `json:"tender_id"`
NoticePublicationID string `json:"notice_publication_id"`
ContractFolderID string `json:"contract_folder_id"`
Title string `json:"title"`
DocumentsScrapedAt int64 `json:"documents_scraped_at,omitempty"` // Unix timestamp (seconds)
DocumentCount int `json:"document_count"`
}
// TendersWithScrapedDocumentsResponse is the paginated list of tenders with scraped documents.
type TendersWithScrapedDocumentsResponse struct {
Tenders []TenderScrapedDocumentsItem `json:"tenders"`
Metadata *response.Meta `json:"-"`
}
// ToTenderScrapedDocumentsItem maps a tender entity to a list item.
func (t *Tender) ToTenderScrapedDocumentsItem() TenderScrapedDocumentsItem {
if t == nil {
return TenderScrapedDocumentsItem{}
}
return TenderScrapedDocumentsItem{
TenderID: t.ID.Hex(),
NoticePublicationID: strings.TrimSpace(t.NoticePublicationID),
ContractFolderID: strings.TrimSpace(t.ContractFolderID),
Title: strings.TrimSpace(t.Title),
DocumentsScrapedAt: t.ProcessingMetadata.DocumentsScrapedAt,
DocumentCount: len(t.ScrapedDocuments),
}
}
// AddressResponse is postal / NUTS address data for API consumers.
type AddressResponse struct {
StreetName string `json:"street_name,omitempty"`