Enhance Tender Search API with Advanced Filtering and Documentation Updates
- Updated the Tender Search API to include additional query parameters for enhanced filtering capabilities, such as currency, deadline ranges, publication dates, languages, and buyer organization ID. - Changed existing query parameter types from integer to string for better flexibility in search queries. - Improved Swagger and YAML documentation to reflect the new parameters and their descriptions, ensuring clarity for API consumers. - Updated handler comments to align with the new query structure, providing comprehensive details for each parameter. - Enhanced response structures to return a well-defined SearchResponse, improving the overall API usability and documentation consistency.
This commit is contained in:
+38
-14
@@ -179,14 +179,26 @@ func (h *TenderHandler) Search(c echo.Context) error {
|
||||
// @Description Retrieve active tenders for mobile application users with automatic company-based matching from customer profile
|
||||
// @Tags Tenders
|
||||
// @Produce json
|
||||
// @Param limit query int false "Number of items per page (default: 20, max: 50)"
|
||||
// @Param offset query int false "Number of items to skip (default: 0)"
|
||||
// @Param country_code query string false "Filter by country code"
|
||||
// @Param q query string false "Search query for title and description"
|
||||
// @Param notice_type query string false "Filter by notice type code"
|
||||
// @Param procurement_type query string false "Filter by procurement type code"
|
||||
// @Param country_codes query []string false "Filter by country codes (comma-separated)"
|
||||
// @Param status query []string false "Filter by status (comma-separated)"
|
||||
// @Param source query []string false "Filter by source (comma-separated)"
|
||||
// @Param min_estimated_value query number false "Minimum estimated value"
|
||||
// @Param max_estimated_value query number false "Maximum estimated value"
|
||||
// @Param publication_from query number false "Publication from"
|
||||
// @Param publication_to query number false "Publication to"
|
||||
// @Success 200 {object} response.APIResponse{data=map[string]interface{}}
|
||||
// @Param currency query string false "Filter by currency"
|
||||
// @Param deadline_from query number false "Deadline from"
|
||||
// @Param deadline_to query number false "Deadline to"
|
||||
// @Param publication_date_from query number false "Publication date from"
|
||||
// @Param publication_date_to query number false "Publication date to"
|
||||
// @Param languages query []string false "Filter by languages (comma-separated)"
|
||||
// @Param buyer_organization_id query string false "Filter by buyer organization ID"
|
||||
// @Param limit query int false "Number of items per page (default: 20, max: 100)"
|
||||
// @Param offset query int false "Number of items to skip (default: 0)"
|
||||
// @Param sort_by query string false "Sort by field"
|
||||
// @Param sort_order query string false "Sort order (asc or desc)"
|
||||
// @Success 200 {object} response.APIResponse{data=SearchResponse}
|
||||
// @Failure 400 {object} response.APIResponse
|
||||
// @Failure 500 {object} response.APIResponse
|
||||
// @Security BearerAuth
|
||||
@@ -216,7 +228,7 @@ func (h *TenderHandler) GetPublicTenders(c echo.Context) error {
|
||||
return response.InternalServerError(c, "Failed to retrieve tenders")
|
||||
}
|
||||
|
||||
return response.Success(c, result, "Tenders retrieved successfully")
|
||||
return response.SuccessWithMeta(c, result, result.Metadata, "Tenders retrieved successfully")
|
||||
}
|
||||
|
||||
// GetPublicTenders retrieves public tenders for mobile app
|
||||
@@ -224,14 +236,26 @@ func (h *TenderHandler) GetPublicTenders(c echo.Context) error {
|
||||
// @Description Retrieve active tenders for mobile application users with automatic company-based matching from customer profile
|
||||
// @Tags Tenders
|
||||
// @Produce json
|
||||
// @Param limit query int false "Number of items per page (default: 20, max: 50)"
|
||||
// @Param offset query int false "Number of items to skip (default: 0)"
|
||||
// @Param country_code query string false "Filter by country code"
|
||||
// @Param q query string false "Search query for title and description"
|
||||
// @Param notice_type query string false "Filter by notice type code"
|
||||
// @Param procurement_type query string false "Filter by procurement type code"
|
||||
// @Param country_codes query []string false "Filter by country codes (comma-separated)"
|
||||
// @Param status query []string false "Filter by status (comma-separated)"
|
||||
// @Param source query []string false "Filter by source (comma-separated)"
|
||||
// @Param min_estimated_value query number false "Minimum estimated value"
|
||||
// @Param max_estimated_value query number false "Maximum estimated value"
|
||||
// @Param publication_from query number false "Publication from"
|
||||
// @Param publication_to query number false "Publication to"
|
||||
// @Success 200 {object} response.APIResponse{data=map[string]interface{}}
|
||||
// @Param currency query string false "Filter by currency"
|
||||
// @Param deadline_from query number false "Deadline from"
|
||||
// @Param deadline_to query number false "Deadline to"
|
||||
// @Param publication_date_from query number false "Publication date from"
|
||||
// @Param publication_date_to query number false "Publication date to"
|
||||
// @Param languages query []string false "Filter by languages (comma-separated)"
|
||||
// @Param buyer_organization_id query string false "Filter by buyer organization ID"
|
||||
// @Param limit query int false "Number of items per page (default: 20, max: 100)"
|
||||
// @Param offset query int false "Number of items to skip (default: 0)"
|
||||
// @Param sort_by query string false "Sort by field"
|
||||
// @Param sort_order query string false "Sort order (asc or desc)"
|
||||
// @Success 200 {object} response.APIResponse{data=SearchResponse}
|
||||
// @Failure 400 {object} response.APIResponse
|
||||
// @Failure 500 {object} response.APIResponse
|
||||
// @Security BearerAuth
|
||||
@@ -261,7 +285,7 @@ func (h *TenderHandler) RecommendTenders(c echo.Context) error {
|
||||
return response.InternalServerError(c, "Failed to retrieve tenders")
|
||||
}
|
||||
|
||||
return response.Success(c, result, "Tenders retrieved successfully")
|
||||
return response.SuccessWithMeta(c, result, result.Metadata, "Tenders retrieved successfully")
|
||||
}
|
||||
|
||||
// GetPublicTenderDetails retrieves public tender details for mobile app
|
||||
|
||||
Reference in New Issue
Block a user