Files
spsays-bff/internal/handler/vani.go
T
2026-07-11 00:31:22 +05:30

29 lines
810 B
Go

package handler
import (
"net/http"
"github.com/prabhupadasays/spsays-bff/internal/service"
"github.com/prabhupadasays/spsays-bff/pkg/response"
)
// VaniHandler serves the public "Vāṇī of the Day" pick for the home page.
type VaniHandler struct {
svc *service.VaniService
}
func NewVaniHandler(svc *service.VaniService) *VaniHandler {
return &VaniHandler{svc: svc}
}
// Today — GET /vani/today. Public; the same pick is returned to everyone for
// the current UTC day. Responds with `data: null` if there's no content.
func (h *VaniHandler) Today(w http.ResponseWriter, r *http.Request) {
payload, err := h.svc.Today(r.Context())
if err != nil {
response.Error(w, http.StatusInternalServerError, "could not load vāṇī of the day")
return
}
response.JSON(w, http.StatusOK, payload)
}