quite a lot of things

This commit is contained in:
Arkaprabha Chakraborty
2025-12-06 03:05:44 +05:30
parent 39c61b7790
commit 28733e22d3
42 changed files with 4214 additions and 204 deletions

28
internal/api/handlers.go Normal file
View File

@@ -0,0 +1,28 @@
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.