a1db2a9790
- Updated README.md to reflect changes in endpoint categories, renaming "Customers-Admin" to "Admin-Customers" and "Companies-Admin" to "Admin-Companies" for consistency. - Modified health check endpoint tags from "Health" to "Admin-Health" to align with the new naming convention. - Adjusted Swagger documentation to replace outdated tags and ensure accurate representation of the API structure. - Enhanced user and customer handler documentation to reflect the new "Admin-Authorization" and "Admin-Users" tags, improving clarity in the API documentation.
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// @Summary Health check endpoint
|
|
// @Description Get comprehensive server health status including system information, dependencies status, and performance metrics. This endpoint is used for monitoring and load balancer health checks.
|
|
// @Tags Admin-Health
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} HealthResponse "System is healthy and operational"
|
|
// @Failure 503 {object} HealthResponse "System is unhealthy or experiencing issues"
|
|
// @Router /admin/v1/health [get]
|
|
func healthHandler(c echo.Context) error {
|
|
return c.JSON(http.StatusOK, HealthResponse{
|
|
Status: "healthy",
|
|
Time: time.Now().Unix(),
|
|
Version: "2.0.0",
|
|
Service: "tender-management-api",
|
|
Uptime: time.Since(time.Now()).String(),
|
|
})
|
|
}
|
|
|
|
// HealthResponse represents the comprehensive health check response
|
|
type HealthResponse struct {
|
|
Status string `json:"status" example:"healthy"` // Current health status
|
|
Time int64 `json:"time" example:"1699123456"` // Current Unix timestamp
|
|
Version string `json:"version" example:"2.0.0"` // API version
|
|
Service string `json:"service" example:"tender-management-api"` // Service name
|
|
Uptime string `json:"uptime,omitempty" example:"24h30m15s"` // Service uptime duration
|
|
}
|