package handlers import ( "net/http" "go-server/internal/service" "github.com/gin-gonic/gin" ) type SupplementController struct { service *service.SupplementService } func NewSupplementController(service *service.SupplementService) *SupplementController { return &SupplementController{service} } func (c *SupplementController) GetAll(ctx *gin.Context) { supplements, err := c.service.GetAll(ctx) if err != nil { ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } ctx.JSON(http.StatusOK, supplements) } func (c *SupplementController) GetDailySupplementsOverview(ctx *gin.Context) { supplements, err := c.service.GetDailySupplementsOverview(ctx) if err != nil { ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } ctx.JSON(http.StatusOK, supplements) }