Files
billit/internal/api/handlers.go
Arkaprabha Chakraborty 28733e22d3 quite a lot of things
2025-12-06 03:05:44 +05:30

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.