Remove ContentXML field from Tender entity and related repository method
- Eliminated the `ContentXML` field from the `Tender` struct in the entity definition, streamlining the data model. - Removed the `FindTendersWithContentXML` method from the `TenderRepository` interface, as it is no longer necessary. - Updated the `ToTender` method in the `NoticeWorker` to reflect these changes, ensuring consistency across the codebase. This update simplifies the tender data structure and repository interface, improving maintainability and clarity in the tender management system.
This commit is contained in:
@@ -565,7 +565,6 @@ func (w *NoticeWorker) ToTender(n *notice.Notice) (*tender.Tender, error) {
|
||||
t.ProcurementProjectID = n.ProcurementProjectID
|
||||
t.SourceFileURL = n.SourceFileURL
|
||||
t.SourceFileName = n.SourceFileName
|
||||
t.ContentXML = n.ContentXML
|
||||
// Preserve document-scraping/summarization flags on the tender (managed by
|
||||
// downstream workers), but refresh the notice-side processing metadata.
|
||||
t.ProcessingMetadata.ScrapedAt = n.ProcessingMetadata.ScrapedAt
|
||||
|
||||
@@ -88,7 +88,6 @@ type Tender struct {
|
||||
Source TenderSource `bson:"source" json:"source"`
|
||||
SourceFileURL string `bson:"source_file_url" json:"source_file_url"`
|
||||
SourceFileName string `bson:"source_file_name" json:"source_file_name"`
|
||||
ContentXML string `bson:"content_xml,omitempty" json:"content_xml,omitempty"`
|
||||
ProcessingMetadata ProcessingMetadata `bson:"processing_metadata" json:"processing_metadata"`
|
||||
// AIOverallSummary optional denormalized overall summary for search/list (e.g. synced from AI pipeline storage).
|
||||
AIOverallSummary string `bson:"ai_overall_summary,omitempty" json:"ai_overall_summary,omitempty"`
|
||||
|
||||
@@ -27,7 +27,6 @@ type TenderRepository interface {
|
||||
// GetLatestByContractFolderIDs returns the most recently updated tender per distinct contract_folder_id.
|
||||
GetLatestByContractFolderIDs(ctx context.Context, contractFolderIDs []string) (map[string]*Tender, error)
|
||||
GetByProcurementProjectID(ctx context.Context, procurementProjectID string) (*Tender, error)
|
||||
FindTendersWithContentXML(ctx context.Context, limit, skip int) ([]Tender, error)
|
||||
GetTenderCountByCountry(ctx context.Context) (map[string]int64, error)
|
||||
GetTenderCountByType(ctx context.Context) (map[string]int64, error)
|
||||
GetTenderCountByClassification(ctx context.Context) (map[string]int64, error)
|
||||
@@ -667,27 +666,6 @@ func (r *tenderRepository) GetByProcurementProjectID(ctx context.Context, procur
|
||||
return &result.Items[0], nil
|
||||
}
|
||||
|
||||
// FindTendersWithContentXML returns tenders that still have TED XML (for backfill after notices were deleted).
|
||||
func (r *tenderRepository) FindTendersWithContentXML(ctx context.Context, limit, skip int) ([]Tender, error) {
|
||||
filter := bson.M{"content_xml": bson.M{"$exists": true, "$ne": ""}}
|
||||
pagination := orm.Pagination{
|
||||
Limit: limit,
|
||||
Skip: skip,
|
||||
SortField: "_id",
|
||||
SortOrder: 1,
|
||||
}
|
||||
|
||||
result, err := r.ormRepo.FindAll(ctx, filter, pagination)
|
||||
if err != nil {
|
||||
r.logger.Error("Failed to list tenders with content_xml", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
})
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result.Items, nil
|
||||
}
|
||||
|
||||
// Update updates an existing tender
|
||||
func (r *tenderRepository) Update(ctx context.Context, tender *Tender) error {
|
||||
tender.UpdatedAt = time.Now().Unix()
|
||||
|
||||
Reference in New Issue
Block a user