Potion/internal/app/server/recipe_handler_v2.go
Hayden Hargreaves 34b0cc4199 (FEAT): Translated the first API.
Auth is next...
2025-11-13 21:38:47 -07:00

31 lines
609 B
Go

package server
import (
"fmt"
"net/http"
"github.com/gin-gonic/gin"
)
func (s *Server) GetRecipeOfTheWeekHandler(ctx *gin.Context) {
// BUG: This needs to be different
userId := 1
recipe, err := s.deps.RecipeService.GetRecipeOfTheWeek(&userId)
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{
"status": http.StatusBadRequest,
"message": fmt.Sprintf("[ERROR] Failed to get recipe of the week. %s\n", err.Error()),
})
return
}
ctx.JSON(http.StatusOK, gin.H{
"status": http.StatusOK,
"message": "[OK] Successfully retrieved recipe of the week.\n",
"recipe": recipe,
})
}