24 lines
519 B
Go
24 lines
519 B
Go
package handler
|
|
|
|
import (
|
|
"billit/internal/database"
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// HealthHandlers holds dependencies for health checks
|
|
type HealthHandlers struct {
|
|
db database.Service
|
|
}
|
|
|
|
// NewHealthHandlers creates health handlers with db access
|
|
func NewHealthHandlers(db database.Service) *HealthHandlers {
|
|
return &HealthHandlers{db: db}
|
|
}
|
|
|
|
// HealthHandler returns the health status
|
|
func (h *HealthHandlers) HealthHandler(c echo.Context) error {
|
|
return c.JSON(http.StatusOK, h.db.Health())
|
|
}
|