From e29283973255cab12944525d3e7a9ef497e74bc5 Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Tue, 19 Aug 2025 14:38:51 +0330 Subject: [PATCH] Update API Documentation for Tender ID Parameter Location - Changed the parameter location for `tender_id` from "query" to "path" in the API documentation across multiple files, including Swagger JSON, YAML, and Go documentation. - Updated the handler method to retrieve `tender_id` from the path instead of the query parameters, ensuring consistency with the updated API structure. - This change enhances the clarity of the API documentation and aligns with Clean Architecture principles by accurately reflecting the intended usage of the `tender_id` parameter. --- cmd/web/docs/docs.go | 2 +- cmd/web/docs/swagger.json | 2 +- cmd/web/docs/swagger.yaml | 2 +- internal/tender_approval/handler.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/web/docs/docs.go b/cmd/web/docs/docs.go index 32d8235..e9e6254 100644 --- a/cmd/web/docs/docs.go +++ b/cmd/web/docs/docs.go @@ -6057,7 +6057,7 @@ const docTemplate = `{ "type": "string", "description": "Tender ID", "name": "tender_id", - "in": "query", + "in": "path", "required": true } ], diff --git a/cmd/web/docs/swagger.json b/cmd/web/docs/swagger.json index e3e3f38..3022f98 100644 --- a/cmd/web/docs/swagger.json +++ b/cmd/web/docs/swagger.json @@ -6051,7 +6051,7 @@ "type": "string", "description": "Tender ID", "name": "tender_id", - "in": "query", + "in": "path", "required": true } ], diff --git a/cmd/web/docs/swagger.yaml b/cmd/web/docs/swagger.yaml index 7b8e63c..9395446 100644 --- a/cmd/web/docs/swagger.yaml +++ b/cmd/web/docs/swagger.yaml @@ -5123,7 +5123,7 @@ paths: company combination parameters: - description: Tender ID - in: query + in: path name: tender_id required: true type: string diff --git a/internal/tender_approval/handler.go b/internal/tender_approval/handler.go index f8a0e95..7e77736 100644 --- a/internal/tender_approval/handler.go +++ b/internal/tender_approval/handler.go @@ -93,7 +93,7 @@ func (h *Handler) GetPublicTenderApproval(c echo.Context) error { // @Tags TenderApprovals // @Accept json // @Produce json -// @Param tender_id query string true "Tender ID" +// @Param tender_id path string true "Tender ID" // @Success 200 {object} response.APIResponse{data=TenderApprovalResponse} "Tender approval retrieved successfully" // @Failure 400 {object} response.APIResponse "Bad request - Invalid tender ID or company ID" // @Failure 404 {object} response.APIResponse "Not found - Tender approval not found" @@ -101,15 +101,15 @@ func (h *Handler) GetPublicTenderApproval(c echo.Context) error { // @Security BearerAuth // @Router /api/v1/tender-approvals/tender/{tender_id} [get] func (h *Handler) GetTenderApprovalByTenderAndCompany(c echo.Context) error { - tenderID := c.QueryParam("tender_id") companyID := c.Get("company_id").(string) if companyID == "" { return response.Unauthorized(c, "Unauthorized") } + tenderID := c.Param("tender_id") if tenderID == "" { - return response.BadRequest(c, "Missing required parameters", "tender_id and company_id are required") + return response.BadRequest(c, "Missing required parameters", "tender_id required") } tenderApprovalWithTender, err := h.service.GetTenderApprovalByTenderAndCompanyWithTender(c.Request().Context(), tenderID, companyID)