feat: added strapi echo routes

This commit is contained in:
darwincereska
2026-02-18 20:25:24 -05:00
parent 9a0e8d46c8
commit 2740d223cb
6 changed files with 117 additions and 47 deletions

View File

@@ -8,10 +8,7 @@ import (
)
// GetAllPosts returns a list of all posts
func GetAllPosts(c *echo.Context, s *services.StrapiService) error {
pageSize := GetIntParam(c, "pageSize", 10)
page := GetIntParam(c, "page", 1)
func GetAllPosts(c *echo.Context, s *services.StrapiService, pageSize, page int) error {
posts, err := s.GetAllPosts(c.Request().Context(), pageSize, page)
if err != nil {
return c.JSON(http.StatusInternalServerError, err)
@@ -21,10 +18,7 @@ func GetAllPosts(c *echo.Context, s *services.StrapiService) error {
}
// GetFeaturedPosts returns a list of featured posts
func GetFeaturedPosts(c *echo.Context, s *services.StrapiService) error {
pageSize := GetIntParam(c, "pageSize", 10)
page := GetIntParam(c, "page", 1)
func GetFeaturedPosts(c *echo.Context, s *services.StrapiService, pageSize, page int) error {
posts, err := s.GetFeaturedPosts(c.Request().Context(), pageSize, page)
if err != nil {
return c.JSON(http.StatusInternalServerError, err)
@@ -44,10 +38,7 @@ func GetPost(c *echo.Context, s *services.StrapiService, slug string) error {
}
// GetPostSummaries returns post summaries
func GetPostSummaries(c *echo.Context, s *services.StrapiService) error {
pageSize := GetIntParam(c, "pageSize", 10)
page := GetIntParam(c, "page", 1)
func GetPostSummaries(c *echo.Context, s *services.StrapiService, pageSize, page int) error {
posts, err := s.GetPostSummaries(c.Request().Context(), pageSize, page)
if err != nil {
return c.JSON(http.StatusInternalServerError, err)