Refactor Tender Management System by Removing Scraping Functionality and Enhancing Tender API

- Removed all scraping-related functionality, including routes, handlers, services, and repository methods, to streamline the tender management system.
- Updated the tender API to focus solely on tender management, enhancing endpoints for listing, retrieving, and updating tenders.
- Improved Swagger documentation to reflect the removal of scraping endpoints and the addition of new tender-related features.
- Ensured adherence to Clean Architecture principles throughout the refactoring process, maintaining a clear separation of concerns.
This commit is contained in:
n.nakhostin
2025-08-16 16:52:17 +03:30
parent 21b736b55b
commit e986ee4135
11 changed files with 239 additions and 4266 deletions
+2 -698
View File
@@ -836,469 +836,43 @@ definitions:
total:
type: integer
type: object
tender.Address:
tender.OrganizationResponse:
properties:
city_name:
type: string
country_code:
type: string
country_subentity_code:
type: string
department:
type: string
postal_zone:
type: string
region:
type: string
street_name:
type: string
type: object
tender.CreateTenderRequest:
properties:
additional_classifications:
items:
type: string
type: array
buyer_organization:
$ref: '#/definitions/tender.Organization'
city_name:
type: string
contract_folder_id:
type: string
contract_notice_id:
type: string
country_code:
type: string
currency:
type: string
description:
type: string
document_uri:
type: string
duration:
type: string
duration_unit:
type: string
estimated_value:
type: number
gazette_id:
type: string
issue_date:
description: Unix milliseconds
type: integer
issue_time:
description: Unix milliseconds
type: integer
main_classification:
type: string
notice_language_code:
type: string
notice_publication_id:
type: string
notice_sub_type_code:
type: string
notice_type_code:
type: string
official_languages:
items:
type: string
type: array
organizations:
items:
$ref: '#/definitions/tender.Organization'
type: array
place_of_performance:
type: string
postal_code:
type: string
procedure_code:
type: string
procurement_type_code:
type: string
publication_date:
description: Unix milliseconds
type: integer
region_code:
type: string
review_organization:
$ref: '#/definitions/tender.Organization'
selection_criteria:
items:
$ref: '#/definitions/tender.SelectionCriterion'
type: array
source:
$ref: '#/definitions/tender.TenderSource'
source_file_name:
type: string
source_file_url:
type: string
tender_deadline:
description: Unix milliseconds
type: integer
tender_url:
type: string
title:
type: string
type: object
tender.JobProgress:
properties:
current_step:
type: string
error_count:
type: integer
percentage:
type: number
processed_count:
type: integer
success_count:
type: integer
total_count:
type: integer
type: object
tender.JobResults:
properties:
processing_errors:
items:
type: string
type: array
summary:
type: string
total_created:
type: integer
total_errors:
type: integer
total_processed:
type: integer
total_skipped:
type: integer
total_updated:
type: integer
type: object
tender.Organization:
properties:
address:
$ref: '#/definitions/tender.Address'
company_id:
type: string
contact_email:
type: string
contact_fax:
type: string
contact_name:
type: string
contact_telephone:
type: string
id:
type: string
name:
type: string
role:
type: string
website_uri:
type: string
type: object
tender.ProcessingMetadata:
properties:
enrichment_data:
additionalProperties:
type: string
type: object
parsing_errors:
items:
type: string
type: array
processed_at:
description: Unix milliseconds
type: integer
processing_version:
type: string
scraped_at:
description: Unix milliseconds
type: integer
validation_errors:
items:
type: string
type: array
type: object
tender.ScrapingJobResponse:
properties:
completed_at:
type: integer
config:
additionalProperties: true
type: object
created_at:
type: integer
duration:
type: integer
errors:
items:
type: string
type: array
id:
type: string
progress:
$ref: '#/definitions/tender.JobProgress'
results:
$ref: '#/definitions/tender.JobResults'
started_at:
type: integer
status:
$ref: '#/definitions/tender.ScrapingJobStatus'
type:
$ref: '#/definitions/tender.ScrapingJobType'
updated_at:
type: integer
type: object
tender.ScrapingJobStatus:
enum:
- pending
- running
- completed
- failed
- cancelled
type: string
x-enum-varnames:
- ScrapingJobStatusPending
- ScrapingJobStatusRunning
- ScrapingJobStatusCompleted
- ScrapingJobStatusFailed
- ScrapingJobStatusCancelled
tender.ScrapingJobType:
enum:
- ted_scraper
- manual
- api
- bulk_import
type: string
x-enum-varnames:
- ScrapingJobTypeTEDScraper
- ScrapingJobTypeManual
- ScrapingJobTypeAPI
- ScrapingJobTypeBulkImport
tender.SearchTendersRequest:
properties:
criteria:
$ref: '#/definitions/tender.TenderSearchCriteria'
query:
type: string
type: object
tender.SelectionCriterion:
properties:
description:
type: string
language_id:
type: string
type_code:
type: string
type: object
tender.StartScrapingJobRequest:
properties:
config:
additionalProperties: true
type: object
type:
$ref: '#/definitions/tender.ScrapingJobType'
type: object
tender.TenderResponse:
properties:
additional_classifications:
items:
type: string
type: array
buyer_organization:
$ref: '#/definitions/tender.Organization'
city_name:
type: string
contract_folder_id:
type: string
contract_notice_id:
type: string
$ref: '#/definitions/tender.OrganizationResponse'
country_code:
type: string
created_at:
type: integer
currency:
type: string
description:
type: string
document_uri:
type: string
duration:
type: string
duration_unit:
type: string
estimated_value:
type: number
formatted_estimated_value:
type: string
gazette_id:
type: string
has_errors:
type: boolean
id:
type: string
is_active:
type: boolean
is_expired:
type: boolean
issue_date:
type: integer
issue_time:
type: integer
main_classification:
type: string
match_percentage:
description: Match percentage for company (0-100)
type: integer
notice_language_code:
type: string
notice_publication_id:
type: string
notice_sub_type_code:
type: string
notice_type_code:
type: string
official_languages:
items:
type: string
type: array
organizations:
items:
$ref: '#/definitions/tender.Organization'
type: array
place_of_performance:
type: string
postal_code:
type: string
procedure_code:
type: string
processing_metadata:
$ref: '#/definitions/tender.ProcessingMetadata'
procurement_type_code:
type: string
publication_date:
type: integer
region_code:
type: string
review_organization:
$ref: '#/definitions/tender.Organization'
selection_criteria:
items:
$ref: '#/definitions/tender.SelectionCriterion'
type: array
source:
$ref: '#/definitions/tender.TenderSource'
source_file_name:
type: string
source_file_url:
type: string
status:
$ref: '#/definitions/tender.TenderStatus'
tender_deadline:
type: integer
tender_url:
type: string
title:
type: string
updated_at:
type: integer
type: object
tender.TenderSearchCriteria:
properties:
buyer_organization_id:
type: string
classifications:
items:
type: string
type: array
country_codes:
items:
type: string
type: array
currency:
type: string
deadline_from:
description: Unix milliseconds
type: integer
deadline_to:
description: Unix milliseconds
type: integer
languages:
items:
type: string
type: array
max_estimated_value:
type: number
min_estimated_value:
type: number
notice_type:
type: string
procurement_type:
type: string
publication_date_from:
description: Unix milliseconds
type: integer
publication_date_to:
description: Unix milliseconds
type: integer
query:
type: string
region_codes:
items:
type: string
type: array
source:
items:
$ref: '#/definitions/tender.TenderSource'
type: array
status:
items:
$ref: '#/definitions/tender.TenderStatus'
type: array
type: object
tender.TenderSource:
enum:
- ted_scraper
- manual
- api
- bulk_import
type: string
x-enum-varnames:
- TenderSourceTEDScraper
- TenderSourceManual
- TenderSourceAPI
- TenderSourceBulkImport
tender.TenderStatistics:
properties:
active_tenders:
type: integer
average_estimated_value:
type: number
expired_tenders:
type: integer
last_updated:
description: Unix milliseconds
type: integer
tenders_by_classification:
additionalProperties:
format: int64
type: integer
type: object
tenders_by_country:
additionalProperties:
format: int64
type: integer
type: object
tenders_by_type:
additionalProperties:
format: int64
type: integer
type: object
total_estimated_value:
type: number
total_tenders:
type: integer
type: object
tender.TenderStatus:
enum:
@@ -1540,145 +1114,6 @@ info:
title: Tender Management API
version: 2.0.0
paths:
/admin/scraping/jobs:
get:
description: Retrieve scraping jobs with pagination
parameters:
- description: 'Number of items per page (default: 20, max: 100)'
in: query
name: limit
type: integer
- description: 'Number of items to skip (default: 0)'
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
additionalProperties: true
type: object
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: List scraping jobs
tags:
- Admin-Scraping
post:
consumes:
- application/json
description: Start a new TED XML scraping job
parameters:
- description: Scraping job configuration
in: body
name: job
required: true
schema:
$ref: '#/definitions/tender.StartScrapingJobRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender.ScrapingJobResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Start scraping job
tags:
- Admin-Scraping
/admin/scraping/jobs/{id}:
get:
description: Retrieve a specific scraping job by its ID
parameters:
- description: Scraping job ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender.ScrapingJobResponse'
type: object
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get scraping job
tags:
- Admin-Scraping
/admin/scraping/jobs/{id}/cancel:
post:
description: Cancel a running or pending scraping job
parameters:
- description: Scraping job ID
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.APIResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Cancel scraping job
tags:
- Admin-Scraping
/admin/tenders:
get:
description: Retrieve tenders with pagination, filtering, and search capabilities
@@ -1767,46 +1202,6 @@ paths:
summary: List tenders
tags:
- Admin-Tenders
post:
consumes:
- application/json
description: Create a new tender with the provided information
parameters:
- description: Tender information
in: body
name: tender
required: true
schema:
$ref: '#/definitions/tender.CreateTenderRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender.TenderResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"409":
description: Conflict
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Create a new tender
tags:
- Admin-Tenders
/admin/tenders/{id}:
delete:
description: Delete a tender by its ID
@@ -1912,94 +1307,6 @@ paths:
summary: Update tender
tags:
- Admin-Tenders
/admin/tenders/dashboard:
get:
description: Retrieve dashboard data including statistics, recent tenders, and
active jobs
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
additionalProperties: true
type: object
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get dashboard data
tags:
- Admin-Tenders
/admin/tenders/search:
post:
consumes:
- application/json
description: Search tenders using full-text search and filtering
parameters:
- description: Search criteria
in: body
name: search
required: true
schema:
$ref: '#/definitions/tender.SearchTendersRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
additionalProperties: true
type: object
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Search tenders
tags:
- Admin-Tenders
/admin/tenders/statistics:
get:
description: Retrieve comprehensive statistics about tenders
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/tender.TenderStatistics'
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get tender statistics
tags:
- Admin-Tenders
/admin/v1/companies:
get:
consumes:
@@ -5251,9 +4558,6 @@ tags:
- description: Administrative tender management operations for web panel including
CRUD operations, search, statistics, and comprehensive filtering with pagination
name: Admin-Tenders
- description: Administrative scraping job management operations for TED XML data
collection including job control, monitoring, and status tracking
name: Admin-Scraping
- description: Administrative feedback management operations for web panel including
CRUD operations, search, statistics, and comprehensive filtering with pagination
name: Admin-Feedback