This commit is contained in:
2025-11-03 12:24:01 +02:00
commit 0806865287
177 changed files with 18453 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
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)
}