Add Company Tender Approval Statistics Endpoint and Update API Documentation
- Introduced a new API endpoint to retrieve company-specific tender approval statistics, enhancing the analytics capabilities of the tender management system. - Implemented the `GetCompanyTenderApprovalStats` method in the service layer to fetch detailed statistics, including total approvals, approved and rejected tenders, and submission counts. - Updated Swagger documentation to accurately reflect the new endpoint, including detailed descriptions, parameters, and response formats for the `CompanyTenderApprovalStatsResponse`. - Enhanced the router to include the new statistics route, ensuring adherence to Clean Architecture principles and maintaining a clear separation of concerns in the handler layer. - Added necessary request and response forms to support the new functionality, improving the overall API structure and usability.
This commit is contained in:
@@ -231,6 +231,31 @@ func (h *Handler) GetTenderApprovalStats(c echo.Context) error {
|
||||
return response.Success(c, stats, "Tender approval statistics retrieved successfully")
|
||||
}
|
||||
|
||||
// GetCompanyTenderApprovalStats returns company-specific tender approval statistics
|
||||
// @Summary Get company tender approval statistics
|
||||
// @Description Get comprehensive tender approval statistics for a specific company
|
||||
// @Tags TenderApprovals
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.APIResponse{data=CompanyTenderApprovalStatsResponse} "Company tender approval statistics retrieved successfully"
|
||||
// @Failure 400 {object} response.APIResponse "Bad request - Invalid company ID"
|
||||
// @Failure 500 {object} response.APIResponse "Internal server error"
|
||||
// @Security BearerAuth
|
||||
// @Router /api/v1/tender-approvals/stats [get]
|
||||
func (h *Handler) GetCompanyTenderApprovalStats(c echo.Context) error {
|
||||
companyID := c.Get("company_id").(string)
|
||||
if companyID == "" {
|
||||
return response.Unauthorized(c, "Unauthorized")
|
||||
}
|
||||
|
||||
stats, err := h.service.GetCompanyTenderApprovalStats(c.Request().Context(), companyID)
|
||||
if err != nil {
|
||||
return response.InternalServerError(c, "Failed to get company tender approval statistics")
|
||||
}
|
||||
|
||||
return response.Success(c, stats, "Company tender approval statistics retrieved successfully")
|
||||
}
|
||||
|
||||
// GetTenderApprovalsByStatus retrieves tender approvals by status
|
||||
// @Summary Get tender approvals by status
|
||||
// @Description Retrieve tender approvals filtered by their status (approved, rejected)
|
||||
|
||||
Reference in New Issue
Block a user