29 lines
712 B
Go
29 lines
712 B
Go
package api
|
|
|
|
import (
|
|
"billit/internal/database"
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// Handlers holds dependencies for API handlers
|
|
type Handlers struct {
|
|
db database.Service
|
|
}
|
|
|
|
// NewHandlers creates API handlers with db access
|
|
func NewHandlers(db database.Service) *Handlers {
|
|
return &Handlers{db: db}
|
|
}
|
|
|
|
// HealthHandler returns the health status
|
|
func (h *Handlers) HealthHandler(c echo.Context) error {
|
|
return c.JSON(http.StatusOK, h.db.Health())
|
|
}
|
|
|
|
// Note: Product and Invoice API endpoints are disabled.
|
|
// All operations go through the authenticated web UI.
|
|
// To re-enable API access, add API authentication and update these handlers
|
|
// to accept userID from authenticated API requests.
|