bottin/handlers/seed.go

25 lines
456 B
Go
Raw Permalink Normal View History

2023-05-25 01:21:09 -05:00
package handlers
import (
"net/http"
"github.com/labstack/echo/v4"
)
func (h *Handler) PostSeed(c echo.Context) error {
rows, err := h.DataClient.Seed()
2023-05-25 01:21:09 -05:00
if err != nil {
return c.JSON(http.StatusInternalServerError, map[string]string{
"message": "Seed failed",
"error": err.Error(),
})
}
return c.JSON(http.StatusOK, map[string]interface{}{
"message": "Seed successful",
"data": map[string]interface{}{
"rows": rows,
},
})
}