Merge pull request 'Remove ContentXML field from Tender entity and related repository method' (#50) from content-xml into develop
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Reviewed-on: https://repo.ravanertebat.com/TM/tm_back/pulls/50 Reviewed-by: Hadi Barzegar <barzagarhadi@gmail.com>
This commit is contained in:
@@ -565,7 +565,6 @@ func (w *NoticeWorker) ToTender(n *notice.Notice) (*tender.Tender, error) {
|
|||||||
t.ProcurementProjectID = n.ProcurementProjectID
|
t.ProcurementProjectID = n.ProcurementProjectID
|
||||||
t.SourceFileURL = n.SourceFileURL
|
t.SourceFileURL = n.SourceFileURL
|
||||||
t.SourceFileName = n.SourceFileName
|
t.SourceFileName = n.SourceFileName
|
||||||
t.ContentXML = n.ContentXML
|
|
||||||
// Preserve document-scraping/summarization flags on the tender (managed by
|
// Preserve document-scraping/summarization flags on the tender (managed by
|
||||||
// downstream workers), but refresh the notice-side processing metadata.
|
// downstream workers), but refresh the notice-side processing metadata.
|
||||||
t.ProcessingMetadata.ScrapedAt = n.ProcessingMetadata.ScrapedAt
|
t.ProcessingMetadata.ScrapedAt = n.ProcessingMetadata.ScrapedAt
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ type Tender struct {
|
|||||||
Source TenderSource `bson:"source" json:"source"`
|
Source TenderSource `bson:"source" json:"source"`
|
||||||
SourceFileURL string `bson:"source_file_url" json:"source_file_url"`
|
SourceFileURL string `bson:"source_file_url" json:"source_file_url"`
|
||||||
SourceFileName string `bson:"source_file_name" json:"source_file_name"`
|
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"`
|
ProcessingMetadata ProcessingMetadata `bson:"processing_metadata" json:"processing_metadata"`
|
||||||
// AIOverallSummary optional denormalized overall summary for search/list (e.g. synced from AI pipeline storage).
|
// 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"`
|
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 returns the most recently updated tender per distinct contract_folder_id.
|
||||||
GetLatestByContractFolderIDs(ctx context.Context, contractFolderIDs []string) (map[string]*Tender, error)
|
GetLatestByContractFolderIDs(ctx context.Context, contractFolderIDs []string) (map[string]*Tender, error)
|
||||||
GetByProcurementProjectID(ctx context.Context, procurementProjectID 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)
|
GetTenderCountByCountry(ctx context.Context) (map[string]int64, error)
|
||||||
GetTenderCountByType(ctx context.Context) (map[string]int64, error)
|
GetTenderCountByType(ctx context.Context) (map[string]int64, error)
|
||||||
GetTenderCountByClassification(ctx context.Context) (map[string]int64, error)
|
GetTenderCountByClassification(ctx context.Context) (map[string]int64, error)
|
||||||
@@ -676,27 +675,6 @@ func (r *tenderRepository) GetByProcurementProjectID(ctx context.Context, procur
|
|||||||
return &result.Items[0], nil
|
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
|
// Update updates an existing tender
|
||||||
func (r *tenderRepository) Update(ctx context.Context, tender *Tender) error {
|
func (r *tenderRepository) Update(ctx context.Context, tender *Tender) error {
|
||||||
tender.UpdatedAt = time.Now().Unix()
|
tender.UpdatedAt = time.Now().Unix()
|
||||||
|
|||||||
Reference in New Issue
Block a user