diff --git a/internal/handlers/ebook.go b/internal/handlers/ebook.go index 07044a4..9877575 100644 --- a/internal/handlers/ebook.go +++ b/internal/handlers/ebook.go @@ -346,8 +346,12 @@ func (h *Handler) GetEbookRating(c echo.Context) error { }) if err != nil { if err == pgx.ErrNoRows { - // If no rating found, return 404 - return c.JSON(http.StatusNotFound, map[string]string{"error": "rating not found"}) + // If no rating found, return rating 0 + return c.JSON(http.StatusOK, map[string]interface{}{ + "ebook_id": ebookIdStr, + "user_id": userID, + "rating": 0, + }) } return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()}) }